home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1995-04-18 | 27.4 KB | [TEXT/MMCC] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Tue Apr 18 18:58:09 1995, modified Tue Apr 18 18:58:09 1995, creator 'MMCC', type ASCII, 27300 bytes "JuggleInterface.c" , at 0x6b24 410 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MMCC] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 11 4a 75 67 67 6c 65 | 49 6e 74 65 72 66 61 63 |..Juggle|Interfac|
|00000010| 65 2e 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |e.c.....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 01 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 6a a4 00 | 00 01 9a ab b9 f4 81 ab |.....j..|........|
|00000060| b9 f4 81 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 6d 29 00 00 |........|....m)..|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 0d 09 | 4a 75 67 67 6c 65 49 6e |------..|JuggleIn|
|000000d0| 74 65 72 66 61 63 65 2e | 63 0d 09 0d 09 52 6f 75 |terface.|c....Rou|
|000000e0| 74 69 6e 65 73 20 74 68 | 61 74 20 64 65 61 6c 20 |tines th|at deal |
|000000f0| 77 69 74 68 20 74 68 65 | 20 6d 6f 75 73 65 2c 20 |with the| mouse, |
|00000100| 61 6e 64 20 72 6f 75 74 | 69 6e 65 73 20 74 68 61 |and rout|ines tha|
|00000110| 74 20 63 6f 6e 76 65 72 | 74 0d 09 62 65 74 77 65 |t conver|t..betwe|
|00000120| 65 6e 20 73 63 72 65 65 | 6e 20 63 6f 6f 72 64 73 |en scree|n coords|
|00000130| 20 61 6e 64 20 70 6f 73 | 69 74 69 6f 6e 20 69 6e | and pos|ition in|
|00000140| 20 6d 65 6d 6f 72 79 0d | 09 0d 2d 2d 2d 2d 2d 2d | memory.|..------|
|00000150| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000160| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000170| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000180| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000190| 2a 2f 0d 0d 23 69 6e 63 | 6c 75 64 65 20 22 50 61 |*/..#inc|lude "Pa|
|000001a0| 70 65 72 4a 75 67 67 6c | 69 6e 67 2e 68 22 0d 23 |perJuggl|ing.h".#|
|000001b0| 69 6e 63 6c 75 64 65 20 | 22 44 69 61 6c 6f 67 55 |include |"DialogU|
|000001c0| 74 69 6c 73 2e 68 22 0d | 0d 2f 2f 2d 2d 2d 2d 2d |tils.h".|.//-----|
|000001d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000001e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000001f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|00000200| 2f 2f 20 47 6c 6f 62 61 | 6c 20 66 6f 72 20 64 6f |// Globa|l for do|
|00000210| 75 62 6c 65 20 63 6c 69 | 63 6b 20 64 65 74 65 63 |uble cli|ck detec|
|00000220| 74 69 6f 6e 0d 73 74 61 | 74 69 63 20 6c 6f 6e 67 |tion.sta|tic long|
|00000230| 09 6c 61 73 74 57 68 65 | 6e 20 3d 20 30 3b 0d 0d |.lastWhe|n = 0;..|
|00000240| 2f 2f 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |//------|--------|
|00000250| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000260| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000270| 2d 2d 2d 2d 2d 2d 0d 2f | 2f 20 6d 6f 75 73 65 20 |------./|/ mouse |
|00000280| 68 61 6e 64 6c 69 6e 67 | 20 72 6f 75 74 69 6e 65 |handling| routine|
|00000290| 73 0d 76 6f 69 64 20 44 | 6f 4a 75 67 67 6c 65 43 |s.void D|oJuggleC|
|000002a0| 6c 69 63 6b 28 57 69 6e | 64 6f 77 50 74 72 20 77 |lick(Win|dowPtr w|
|000002b0| 69 6e 64 6f 77 2c 20 50 | 6f 69 6e 74 20 70 2c 20 |indow, P|oint p, |
|000002c0| 45 76 65 6e 74 52 65 63 | 6f 72 64 20 2a 65 76 65 |EventRec|ord *eve|
|000002d0| 6e 74 29 0d 7b 0d 09 4a | 75 67 67 6c 65 48 61 6e |nt).{..J|uggleHan|
|000002e0| 64 6c 65 09 61 4a 75 67 | 67 6c 65 20 3d 20 47 65 |dle.aJug|gle = Ge|
|000002f0| 74 57 69 6e 64 6f 77 4a | 75 67 67 6c 65 28 77 69 |tWindowJ|uggle(wi|
|00000300| 6e 64 6f 77 29 3b 0d 09 | 67 78 50 6f 69 6e 74 09 |ndow);..|gxPoint.|
|00000310| 09 09 63 6c 69 63 6b 50 | 74 3b 0d 20 20 20 20 67 |..clickP|t;. g|
|00000320| 78 48 69 74 54 65 73 74 | 49 6e 66 6f 09 72 65 73 |xHitTest|Info.res|
|00000330| 75 6c 74 3b 0d 20 20 20 | 20 67 78 53 68 61 70 65 |ult;. | gxShape|
|00000340| 09 09 09 73 68 61 70 65 | 48 69 74 3b 0d 20 20 20 |...shape|Hit;. |
|00000350| 20 42 6f 6f 6c 65 61 6e | 09 09 09 64 6f 75 62 6c | Boolean|...doubl|
|00000360| 65 43 6c 69 63 6b 20 3d | 20 66 61 6c 73 65 3b 0d |eClick =| false;.|
|00000370| 20 20 20 20 67 78 4d 61 | 70 70 69 6e 67 09 09 70 | gxMa|pping..p|
|00000380| 6f 72 74 4d 61 70 70 69 | 6e 67 3b 0d 09 0d 09 2f |ortMappi|ng;..../|
|00000390| 2f 20 67 65 74 20 6d 6f | 75 73 65 20 70 6f 73 69 |/ get mo|use posi|
|000003a0| 74 69 6f 6e 20 69 6e 20 | 76 69 65 77 50 6f 72 74 |tion in |viewPort|
|000003b0| 0d 09 53 68 6f 72 74 50 | 6f 69 6e 74 54 6f 46 69 |..ShortP|ointToFi|
|000003c0| 78 65 64 28 26 70 2c 20 | 26 63 6c 69 63 6b 50 74 |xed(&p, |&clickPt|
|000003d0| 29 3b 0d 09 47 58 47 65 | 74 56 69 65 77 50 6f 72 |);..GXGe|tViewPor|
|000003e0| 74 4d 61 70 70 69 6e 67 | 28 47 65 74 57 69 6e 64 |tMapping|(GetWind|
|000003f0| 6f 77 47 58 50 6f 72 74 | 28 77 69 6e 64 6f 77 29 |owGXPort|(window)|
|00000400| 2c 20 26 70 6f 72 74 4d | 61 70 70 69 6e 67 29 3b |, &portM|apping);|
|00000410| 0d 09 49 6e 76 65 72 74 | 4d 61 70 70 69 6e 67 28 |..Invert|Mapping(|
|00000420| 26 70 6f 72 74 4d 61 70 | 70 69 6e 67 2c 20 26 70 |&portMap|ping, &p|
|00000430| 6f 72 74 4d 61 70 70 69 | 6e 67 29 3b 0d 09 4d 61 |ortMappi|ng);..Ma|
|00000440| 70 50 6f 69 6e 74 73 28 | 26 70 6f 72 74 4d 61 70 |pPoints(|&portMap|
|00000450| 70 69 6e 67 2c 20 31 2c | 20 26 63 6c 69 63 6b 50 |ping, 1,| &clickP|
|00000460| 74 29 3b 0d 20 20 20 20 | 0d 09 2f 2f 20 43 68 65 |t);. |..// Che|
|00000470| 63 6b 20 66 6f 72 20 64 | 6f 75 62 6c 65 20 63 6c |ck for d|ouble cl|
|00000480| 69 63 6b 0d 09 69 66 20 | 28 20 65 76 65 6e 74 2d |ick..if |( event-|
|00000490| 3e 77 68 65 6e 20 2d 20 | 6c 61 73 74 57 68 65 6e |>when - |lastWhen|
|000004a0| 20 3c 20 47 65 74 44 62 | 6c 54 69 6d 65 28 29 20 | < GetDb|lTime() |
|000004b0| 29 0d 09 7b 0d 09 09 64 | 6f 75 62 6c 65 43 6c 69 |)..{...d|oubleCli|
|000004c0| 63 6b 20 3d 20 74 72 75 | 65 3b 09 2f 2f 20 69 74 |ck = tru|e;.// it|
|000004d0| 27 73 20 61 20 64 6f 75 | 62 6c 65 20 63 6c 69 63 |'s a dou|ble clic|
|000004e0| 6b 0d 09 09 6c 61 73 74 | 57 68 65 6e 20 3d 20 30 |k...last|When = 0|
|000004f0| 3b 20 2f 2f 20 73 6f 20 | 74 72 69 70 6c 65 20 63 |; // so |triple c|
|00000500| 6c 69 63 6b 73 20 61 72 | 65 6e 27 74 20 73 65 65 |licks ar|en't see|
|00000510| 6e 20 61 73 20 74 77 6f | 20 64 6f 75 62 6c 65 73 |n as two| doubles|
|00000520| 0d 09 7d 0d 09 65 6c 73 | 65 0d 09 09 6c 61 73 74 |..}..els|e...last|
|00000530| 57 68 65 6e 20 3d 20 65 | 76 65 6e 74 2d 3e 77 68 |When = e|vent->wh|
|00000540| 65 6e 3b 0d 0d 20 20 20 | 20 2f 2f 20 4c 6f 6f 6b |en;.. | // Look|
|00000550| 20 66 6f 72 20 61 20 68 | 69 74 20 6f 6e 20 61 20 | for a h|it on a |
|00000560| 74 68 72 6f 77 0d 20 20 | 20 20 73 68 61 70 65 48 |throw. | shapeH|
|00000570| 69 74 20 3d 20 47 58 48 | 69 74 54 65 73 74 50 69 |it = GXH|itTestPi|
|00000580| 63 74 75 72 65 28 47 65 | 74 44 6f 63 54 68 72 6f |cture(Ge|tDocThro|
|00000590| 77 73 50 69 63 74 28 77 | 69 6e 64 6f 77 29 2c 0d |wsPict(w|indow),.|
|000005a0| 09 09 09 09 09 09 09 09 | 09 26 63 6c 69 63 6b 50 |........|.&clickP|
|000005b0| 74 2c 0d 09 09 09 09 09 | 09 09 09 09 26 72 65 73 |t,......|....&res|
|000005c0| 75 6c 74 2c 20 30 2c 20 | 31 29 3b 0d 09 2f 2f 20 |ult, 0, |1);..// |
|000005d0| 49 66 20 61 20 68 69 74 | 2c 20 64 72 61 67 20 74 |If a hit|, drag t|
|000005e0| 68 65 20 74 68 72 6f 77 | 0d 09 69 66 20 28 73 68 |he throw|..if (sh|
|000005f0| 61 70 65 48 69 74 20 21 | 3d 20 6e 69 6c 29 0d 09 |apeHit !|= nil)..|
|00000600| 7b 0d 09 09 2f 2f 20 4d | 61 72 6b 20 64 69 72 74 |{...// M|ark dirt|
|00000610| 79 0d 09 09 28 2a 61 4a | 75 67 67 6c 65 29 2d 3e |y...(*aJ|uggle)->|
|00000620| 64 69 72 74 79 20 3d 20 | 74 72 75 65 3b 0d 09 09 |dirty = |true;...|
|00000630| 0d 09 09 2f 2f 20 49 66 | 20 6f 70 74 69 6f 6e 20 |...// If| option |
|00000640| 6b 65 79 20 69 73 20 64 | 6f 77 6e 2c 20 72 65 6d |key is d|own, rem|
|00000650| 6f 76 65 20 69 74 20 69 | 6e 73 74 65 61 64 0d 09 |ove it i|nstead..|
|00000660| 09 69 66 28 65 76 65 6e | 74 2d 3e 6d 6f 64 69 66 |.if(even|t->modif|
|00000670| 69 65 72 73 20 26 20 6f | 70 74 69 6f 6e 4b 65 79 |iers & o|ptionKey|
|00000680| 29 0d 09 09 7b 0d 09 09 | 09 67 78 4c 69 6e 65 09 |)...{...|.gxLine.|
|00000690| 6c 69 6e 65 44 61 74 61 | 3b 0d 09 09 09 0d 09 09 |lineData|;.......|
|000006a0| 09 2f 2f 20 52 65 6d 6f | 76 65 20 66 72 6f 6d 20 |.// Remo|ve from |
|000006b0| 63 6f 6e 6e 65 63 74 69 | 6f 6e 73 20 64 61 74 61 |connecti|ons data|
|000006c0| 0d 09 09 09 47 58 47 65 | 74 4c 69 6e 65 28 73 68 |....GXGe|tLine(sh|
|000006d0| 61 70 65 48 69 74 2c 20 | 26 6c 69 6e 65 44 61 74 |apeHit, |&lineDat|
|000006e0| 61 29 3b 0d 09 09 09 4c | 69 6e 65 54 6f 52 65 6d |a);....L|ineToRem|
|000006f0| 6f 76 65 64 54 68 72 6f | 77 28 61 4a 75 67 67 6c |ovedThro|w(aJuggl|
|00000700| 65 2c 20 26 6c 69 6e 65 | 44 61 74 61 29 3b 0d 09 |e, &line|Data);..|
|00000710| 09 09 0d 09 09 09 2f 2f | 20 45 72 61 73 65 20 73 |......//| Erase s|
|00000720| 68 61 70 65 20 61 6e 64 | 20 72 65 6d 6f 76 65 20 |hape and| remove |
|00000730| 66 72 6f 6d 20 70 69 63 | 74 75 72 65 28 73 29 0d |from pic|ture(s).|
|00000740| 09 09 09 52 65 6d 6f 76 | 65 54 68 72 6f 77 53 68 |...Remov|eThrowSh|
|00000750| 61 70 65 28 61 4a 75 67 | 67 6c 65 2c 20 72 65 73 |ape(aJug|gle, res|
|00000760| 75 6c 74 2e 63 6f 6e 74 | 61 69 6e 65 72 49 6e 64 |ult.cont|ainerInd|
|00000770| 65 78 29 3b 0d 09 09 7d | 0d 09 09 65 6c 73 65 20 |ex);...}|...else |
|00000780| 2f 2f 20 64 72 61 67 20 | 69 74 0d 09 09 7b 0d 09 |// drag |it...{..|
|00000790| 09 09 2f 2f 20 69 66 20 | 69 74 27 73 20 6e 6f 74 |..// if |it's not|
|000007a0| 20 70 6f 69 6e 74 20 31 | 20 28 74 68 65 20 74 61 | point 1| (the ta|
|000007b0| 69 6c 29 2c 20 64 72 61 | 67 20 70 6f 69 6e 74 20 |il), dra|g point |
|000007c0| 32 20 28 74 68 65 20 61 | 72 72 6f 77 20 68 65 61 |2 (the a|rrow hea|
|000007d0| 64 29 0d 09 09 09 2f 2f | 20 28 73 6f 20 63 6c 69 |d)....//| (so cli|
|000007e0| 63 6b 73 20 6f 6e 20 74 | 68 65 20 6c 69 6e 65 20 |cks on t|he line |
|000007f0| 69 74 73 65 6c 66 20 64 | 72 61 67 20 74 68 65 20 |itself d|rag the |
|00000800| 68 65 61 64 29 0d 09 09 | 09 44 72 61 67 54 68 72 |head)...|.DragThr|
|00000810| 6f 77 28 61 4a 75 67 67 | 6c 65 2c 20 72 65 73 75 |ow(aJugg|le, resu|
|00000820| 6c 74 2e 63 6f 6e 74 61 | 69 6e 65 72 49 6e 64 65 |lt.conta|inerInde|
|00000830| 78 2c 20 72 65 73 75 6c | 74 2e 69 6e 64 65 78 2c |x, resul|t.index,|
|00000840| 20 26 63 6c 69 63 6b 50 | 74 29 3b 0d 09 09 7d 0d | &clickP|t);...}.|
|00000850| 09 7d 0d 09 2f 2f 20 45 | 6c 73 65 20 6c 6f 6f 6b |.}..// E|lse look|
|00000860| 20 66 6f 72 20 61 20 68 | 69 74 20 6f 6e 20 61 20 | for a h|it on a |
|00000870| 6a 75 67 67 6c 65 72 0d | 09 65 6c 73 65 0d 09 7b |juggler.|.else..{|
|00000880| 0d 09 09 48 61 6e 64 50 | 74 72 09 09 68 69 74 48 |...HandP|tr..hitH|
|00000890| 61 6e 64 3b 0d 09 09 48 | 61 6e 64 4c 6f 63 09 09 |and;...H|andLoc..|
|000008a0| 61 4c 6f 63 20 3d 20 7b | 30 2c 20 30 7d 3b 0d 09 |aLoc = {|0, 0};..|
|000008b0| 09 67 78 50 6f 69 6e 74 | 09 09 73 61 76 65 64 50 |.gxPoint|..savedP|
|000008c0| 74 2c 20 67 72 69 64 20 | 3d 20 28 2a 61 4a 75 67 |t, grid |= (*aJug|
|000008d0| 67 6c 65 29 2d 3e 67 72 | 69 64 50 74 3b 0d 09 09 |gle)->gr|idPt;...|
|000008e0| 42 6f 6f 6c 65 61 6e 09 | 09 67 72 69 64 64 65 64 |Boolean.|.gridded|
|000008f0| 3b 0d 09 0d 09 09 2f 2f | 20 69 66 20 69 74 27 73 |;.....//| if it's|
|00000900| 20 63 6c 6f 73 65 20 65 | 6e 6f 75 67 68 20 74 6f | close e|nough to|
|00000910| 20 61 20 67 72 69 64 20 | 70 6f 69 6e 74 0d 09 09 | a grid |point...|
|00000920| 73 61 76 65 64 50 74 20 | 3d 20 63 6c 69 63 6b 50 |savedPt |= clickP|
|00000930| 74 3b 0d 09 09 67 72 69 | 64 64 65 64 20 3d 20 44 |t;...gri|dded = D|
|00000940| 65 74 65 6e 74 28 26 63 | 6c 69 63 6b 50 74 2c 20 |etent(&c|lickPt, |
|00000950| 26 67 72 69 64 2c 20 6b | 48 61 6e 64 52 61 64 69 |&grid, k|HandRadi|
|00000960| 75 73 29 3b 0d 09 09 69 | 66 28 67 72 69 64 64 65 |us);...i|f(gridde|
|00000970| 64 29 0d 09 09 7b 0d 09 | 09 09 2f 2f 20 67 65 74 |d)...{..|..// get|
|00000980| 20 74 68 65 20 68 61 6e | 64 4c 6f 63 20 61 6e 64 | the han|dLoc and|
|00000990| 20 61 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 74 68 | a point|er to th|
|000009a0| 65 20 68 61 6e 64 20 28 | 64 6f 6e 27 74 20 77 72 |e hand (|don't wr|
|000009b0| 61 70 21 29 0d 09 09 09 | 50 6f 69 6e 74 54 6f 48 |ap!)....|PointToH|
|000009c0| 61 6e 64 4c 6f 63 28 61 | 4a 75 67 67 6c 65 2c 20 |andLoc(a|Juggle, |
|000009d0| 26 63 6c 69 63 6b 50 74 | 2c 20 26 61 4c 6f 63 2c |&clickPt|, &aLoc,|
|000009e0| 20 66 61 6c 73 65 29 3b | 0d 09 09 09 68 69 74 48 | false);|....hitH|
|000009f0| 61 6e 64 20 3d 20 47 65 | 74 48 61 6e 64 28 61 4a |and = Ge|tHand(aJ|
|00000a00| 75 67 67 6c 65 2c 20 61 | 4c 6f 63 2c 20 66 61 6c |uggle, a|Loc, fal|
|00000a10| 73 65 29 3b 0d 09 09 09 | 0d 09 09 09 2f 2f 20 69 |se);....|....// i|
|00000a20| 66 20 61 20 68 61 6e 64 | 20 6f 72 20 6c 61 62 65 |f a hand| or labe|
|00000a30| 6c 20 77 61 73 20 68 69 | 74 2c 20 64 6f 20 73 74 |l was hi|t, do st|
|00000a40| 75 66 66 0d 09 09 09 69 | 66 28 61 4c 6f 63 2e 74 |uff....i|f(aLoc.t|
|00000a50| 69 6d 65 20 21 3d 20 30 | 29 0d 09 09 09 7b 0d 09 |ime != 0|)....{..|
|00000a60| 09 09 09 67 78 53 68 61 | 70 65 09 09 68 69 74 4a |...gxSha|pe..hitJ|
|00000a70| 75 67 67 6c 65 72 3b 0d | 09 09 09 09 0d 09 09 09 |uggler;.|........|
|00000a80| 09 2f 2f 20 4d 61 72 6b | 20 64 69 72 74 79 0d 09 |.// Mark| dirty..|
|00000a90| 09 09 09 28 2a 61 4a 75 | 67 67 6c 65 29 2d 3e 64 |...(*aJu|ggle)->d|
|00000aa0| 69 72 74 79 20 3d 20 74 | 72 75 65 3b 0d 09 09 09 |irty = t|rue;....|
|00000ab0| 09 0d 09 09 09 09 2f 2f | 20 67 65 74 20 74 68 65 |......//| get the|
|00000ac0| 20 6a 75 67 67 6c 65 72 | 20 70 69 63 74 75 72 65 | juggler| picture|
|00000ad0| 0d 09 09 09 09 47 65 74 | 50 69 63 74 75 72 65 49 |.....Get|PictureI|
|00000ae0| 74 65 6d 28 28 2a 61 4a | 75 67 67 6c 65 29 2d 3e |tem((*aJ|uggle)->|
|00000af0| 6a 75 67 67 6c 65 72 73 | 50 69 63 74 2c 0d 09 09 |jugglers|Pict,...|
|00000b00| 09 09 09 09 09 09 09 4a | 75 67 67 6c 65 72 54 6f |.......J|ugglerTo|
|00000b10| 52 6f 77 28 61 4a 75 67 | 67 6c 65 2c 20 61 4c 6f |Row(aJug|gle, aLo|
|00000b20| 63 2e 6a 75 67 67 6c 65 | 72 29 2c 0d 09 09 09 09 |c.juggle|r),.....|
|00000b30| 09 09 09 09 09 26 68 69 | 74 4a 75 67 67 6c 65 72 |.....&hi|tJuggler|
|00000b40| 2c 20 6e 69 6c 2c 20 6e | 69 6c 2c 20 6e 69 6c 29 |, nil, n|il, nil)|
|00000b50| 3b 0d 09 09 09 09 0d 09 | 09 09 09 2f 2f 20 49 66 |;.......|...// If|
|00000b60| 20 63 6f 6d 6d 61 6e 64 | 20 6b 65 79 20 69 73 20 | command| key is |
|00000b70| 64 6f 77 6e 2c 20 73 68 | 69 66 74 20 6a 75 67 67 |down, sh|ift jugg|
|00000b80| 6c 65 72 20 69 6e 20 74 | 69 6d 65 0d 09 09 09 09 |ler in t|ime.....|
|00000b90| 69 66 28 65 76 65 6e 74 | 2d 3e 6d 6f 64 69 66 69 |if(event|->modifi|
|00000ba0| 65 72 73 20 26 20 63 6d | 64 4b 65 79 29 0d 09 09 |ers & cm|dKey)...|
|00000bb0| 09 09 7b 0d 09 09 09 09 | 09 44 72 61 67 4a 75 67 |..{.....|.DragJug|
|00000bc0| 67 6c 65 72 28 77 69 6e | 64 6f 77 2c 20 68 69 74 |gler(win|dow, hit|
|00000bd0| 4a 75 67 67 6c 65 72 2c | 20 26 63 6c 69 63 6b 50 |Juggler,| &clickP|
|00000be0| 74 2c 0d 09 09 09 09 09 | 09 09 09 09 09 61 4c 6f |t,......|.....aLo|
|00000bf0| 63 2e 6a 75 67 67 6c 65 | 72 2c 20 68 41 78 69 73 |c.juggle|r, hAxis|
|00000c00| 4f 6e 6c 79 29 3b 0d 09 | 09 09 09 7d 0d 09 09 09 |Only);..|...}....|
|00000c10| 09 2f 2f 20 65 6c 73 65 | 20 69 66 20 74 68 65 20 |.// else| if the |
|00000c20| 6f 70 74 69 6f 6e 20 6b | 65 79 20 69 73 20 64 6f |option k|ey is do|
|00000c30| 77 6e 2c 20 72 65 6d 6f | 76 65 20 6a 75 67 67 6c |wn, remo|ve juggl|
|00000c40| 65 72 0d 09 09 09 09 65 | 6c 73 65 20 69 66 28 65 |er.....e|lse if(e|
|00000c50| 76 65 6e 74 2d 3e 6d 6f | 64 69 66 69 65 72 73 20 |vent->mo|difiers |
|00000c60| 26 20 6f 70 74 69 6f 6e | 4b 65 79 29 0d 09 09 09 |& option|Key)....|
|00000c70| 09 7b 0d 09 09 09 09 09 | 2f 2f 52 65 6d 6f 76 65 |.{......|//Remove|
|00000c80| 4a 75 67 67 6c 65 72 28 | 77 69 6e 64 6f 77 2c 20 |Juggler(|window, |
|00000c90| 61 4c 6f 63 2e 6a 75 67 | 67 6c 65 72 29 3b 0d 09 |aLoc.jug|gler);..|
|00000ca0| 09 09 09 7d 0d 09 09 09 | 09 65 6c 73 65 20 69 66 |...}....|.else if|
|00000cb0| 20 28 68 69 74 48 61 6e | 64 20 21 3d 20 6e 69 6c | (hitHan|d != nil|
|00000cc0| 29 20 2f 2f 20 61 20 68 | 61 6e 64 20 77 61 73 20 |) // a h|and was |
|00000cd0| 68 69 74 0d 09 09 09 09 | 7b 0d 09 09 09 09 09 2f |hit.....|{....../|
|00000ce0| 2f 20 49 66 20 74 68 65 | 20 68 61 6e 64 20 68 61 |/ If the| hand ha|
|00000cf0| 73 20 6e 6f 20 73 69 6e | 6b 20 79 65 74 2c 20 61 |s no sin|k yet, a|
|00000d00| 73 73 75 6d 65 20 74 68 | 65 20 75 73 65 72 20 77 |ssume th|e user w|
|00000d10| 61 6e 74 73 0d 09 09 09 | 09 09 2f 2f 20 74 6f 20 |ants....|..// to |
|00000d20| 61 64 64 20 6f 6e 65 2e | 0d 09 09 09 09 09 69 66 |add one.|......if|
|00000d30| 28 68 69 74 48 61 6e 64 | 2d 3e 73 69 6e 6b 2e 74 |(hitHand|->sink.t|
|00000d40| 69 6d 65 20 3d 3d 20 30 | 29 0d 09 09 09 09 09 7b |ime == 0|)......{|
|00000d50| 0d 09 09 09 09 09 09 44 | 72 61 67 4e 65 77 54 68 |.......D|ragNewTh|
|00000d60| 72 6f 77 28 77 69 6e 64 | 6f 77 2c 20 26 63 6c 69 |row(wind|ow, &cli|
|00000d70| 63 6b 50 74 29 3b 0d 09 | 09 09 09 09 7d 0d 09 09 |ckPt);..|....}...|
|00000d80| 09 09 7d 0d 09 09 09 09 | 65 6c 73 65 20 69 66 28 |..}.....|else if(|
|00000d90| 61 4c 6f 63 2e 74 69 6d | 65 20 3d 3d 20 2d 31 20 |aLoc.tim|e == -1 |
|00000da0| 26 26 20 61 4c 6f 63 2e | 6a 75 67 67 6c 65 72 20 |&& aLoc.|juggler |
|00000db0| 3e 20 30 29 20 2f 2f 20 | 6c 61 62 65 6c 20 68 69 |> 0) // |label hi|
|00000dc0| 74 0d 09 09 09 09 7b 0d | 09 09 09 09 09 2f 2f 20 |t.....{.|.....// |
|00000dd0| 49 66 20 61 20 64 6f 75 | 62 6c 65 20 63 6c 69 63 |If a dou|ble clic|
|00000de0| 6b 2c 20 72 65 76 65 72 | 73 65 20 68 61 6e 64 73 |k, rever|se hands|
|00000df0| 20 61 6e 64 20 72 65 64 | 72 61 77 0d 09 09 09 09 | and red|raw.....|
|00000e00| 09 69 66 28 64 6f 75 62 | 6c 65 43 6c 69 63 6b 29 |.if(doub|leClick)|
|00000e10| 0d 09 09 09 09 09 7b 0d | 09 09 09 09 09 09 53 77 |......{.|......Sw|
|00000e20| 69 74 63 68 4a 75 67 67 | 6c 65 72 48 61 6e 64 73 |itchJugg|lerHands|
|00000e30| 28 61 4a 75 67 67 6c 65 | 2c 20 61 4c 6f 63 2e 6a |(aJuggle|, aLoc.j|
|00000e40| 75 67 67 6c 65 72 29 3b | 0d 09 09 09 09 09 09 45 |uggler);|.......E|
|00000e50| 72 61 73 65 52 65 63 74 | 28 26 77 69 6e 64 6f 77 |raseRect|(&window|
|00000e60| 2d 3e 70 6f 72 74 52 65 | 63 74 29 3b 0d 09 09 09 |->portRe|ct);....|
|00000e70| 09 09 09 49 6e 76 61 6c | 52 65 63 74 28 26 77 69 |...Inval|Rect(&wi|
|00000e80| 6e 64 6f 77 2d 3e 70 6f | 72 74 52 65 63 74 29 3b |ndow->po|rtRect);|
|00000e90| 0d 09 09 09 09 09 7d 0d | 09 09 09 09 09 65 6c 73 |......}.|.....els|
|00000ea0| 65 0d 09 09 09 09 09 7b | 0d 09 09 09 09 09 09 2f |e......{|......./|
|00000eb0| 2f 20 64 72 61 67 20 6a | 75 67 67 6c 65 72 20 76 |/ drag j|uggler v|
|00000ec0| 65 72 74 69 63 61 6c 6c | 79 0d 09 09 09 09 09 09 |erticall|y.......|
|00000ed0| 44 72 61 67 4a 75 67 67 | 6c 65 72 28 77 69 6e 64 |DragJugg|ler(wind|
|00000ee0| 6f 77 2c 20 68 69 74 4a | 75 67 67 6c 65 72 2c 20 |ow, hitJ|uggler, |
|00000ef0| 26 63 6c 69 63 6b 50 74 | 2c 20 61 4c 6f 63 2e 6a |&clickPt|, aLoc.j|
|00000f00| 75 67 67 6c 65 72 2c 20 | 76 41 78 69 73 4f 6e 6c |uggler, |vAxisOnl|
|00000f10| 79 29 3b 0d 09 09 09 09 | 09 7d 0d 09 09 09 09 7d |y);.....|.}.....}|
|00000f20| 0d 09 09 09 7d 0d 09 09 | 7d 0d 09 7d 0d 7d 0d 0d |....}...|}..}.}..|
|00000f30| 2f 2f 20 44 72 61 67 20 | 61 72 6f 75 6e 64 20 61 |// Drag |around a|
|00000f40| 20 67 72 61 79 20 6f 75 | 74 6c 69 6e 65 20 6f 66 | gray ou|tline of|
|00000f50| 20 74 68 65 20 6a 75 67 | 67 6c 65 72 2c 20 75 73 | the jug|gler, us|
|00000f60| 69 6e 67 20 51 75 69 63 | 6b 44 72 61 77 0d 76 6f |ing Quic|kDraw.vo|
|00000f70| 69 64 20 44 72 61 67 4a | 75 67 67 6c 65 72 28 57 |id DragJ|uggler(W|
|00000f80| 69 6e 64 6f 77 50 74 72 | 20 77 69 6e 64 6f 77 2c |indowPtr| window,|
|00000f90| 20 67 78 53 68 61 70 65 | 20 6a 75 67 67 6c 65 72 | gxShape| juggler|
|00000fa0| 50 69 63 74 2c 20 67 78 | 50 6f 69 6e 74 20 2a 63 |Pict, gx|Point *c|
|00000fb0| 6c 69 63 6b 50 74 2c 0d | 09 09 09 09 09 09 73 68 |lickPt,.|......sh|
|00000fc0| 6f 72 74 20 77 68 69 63 | 68 4a 75 67 67 6c 65 72 |ort whic|hJuggler|
|00000fd0| 2c 20 73 68 6f 72 74 20 | 63 6f 6e 73 74 72 61 69 |, short |constrai|
|00000fe0| 6e 74 29 0d 7b 0d 09 52 | 67 6e 48 61 6e 64 6c 65 |nt).{..R|gnHandle|
|00000ff0| 09 09 72 67 6e 3b 0d 09 | 50 6f 69 6e 74 09 09 09 |..rgn;..|Point...|
|00001000| 73 68 6f 72 74 47 72 69 | 64 2c 20 71 64 4f 72 69 |shortGri|d, qdOri|
|00001010| 67 69 6e 2c 20 72 65 73 | 75 6c 74 50 74 2c 20 71 |gin, res|ultPt, q|
|00001020| 64 43 6c 69 63 6b 3b 0d | 09 52 65 63 74 09 09 09 |dClick;.|.Rect...|
|00001030| 6c 69 6d 69 74 52 65 63 | 74 2c 20 73 6c 6f 70 52 |limitRec|t, slopR|
|00001040| 65 63 74 3b 0d 09 4a 75 | 67 67 6c 65 48 61 6e 64 |ect;..Ju|ggleHand|
|00001050| 6c 65 09 61 4a 75 67 67 | 6c 65 3b 0d 09 67 78 50 |le.aJugg|le;..gxP|
|00001060| 6f 69 6e 74 09 09 09 67 | 72 69 64 50 74 3b 0d 09 |oint...g|ridPt;..|
|00001070| 67 78 53 68 61 70 65 09 | 09 09 68 61 6e 64 3b 0d |gxShape.|..hand;.|
|00001080| 09 0d 09 61 4a 75 67 67 | 6c 65 20 3d 20 47 65 74 |...aJugg|le = Get|
|00001090| 57 69 6e 64 6f 77 4a 75 | 67 67 6c 65 28 77 69 6e |WindowJu|ggle(win|
|000010a0| 64 6f 77 29 3b 0d 09 67 | 72 69 64 50 74 20 3d 20 |dow);..g|ridPt = |
|000010b0| 28 2a 61 4a 75 67 67 6c | 65 29 2d 3e 67 72 69 64 |(*aJuggl|e)->grid|
|000010c0| 50 74 3b 0d 09 09 09 0d | 09 2f 2f 20 53 65 74 20 |Pt;.....|.// Set |
|000010d0| 75 70 20 74 68 65 20 67 | 72 69 64 0d 09 46 69 78 |up the g|rid..Fix|
|000010e0| 65 64 50 6f 69 6e 74 54 | 6f 53 68 6f 72 74 28 26 |edPointT|oShort(&|
|000010f0| 67 72 69 64 50 74 2c 20 | 26 73 68 6f 72 74 47 72 |gridPt, |&shortGr|
|00001100| 69 64 29 3b 0d 0d 09 2f | 2f 20 53 65 74 20 74 68 |id);.../|/ Set th|
|00001110| 65 20 51 44 20 6f 72 69 | 67 69 6e 20 74 6f 20 72 |e QD ori|gin to r|
|00001120| 65 66 6c 65 63 74 20 74 | 68 65 20 64 6f 63 50 6f |eflect t|he docPo|
|00001130| 72 74 27 73 20 6d 61 70 | 70 69 6e 67 0d 09 71 64 |rt's map|ping..qd|
|00001140| 4f 72 69 67 69 6e 20 3d | 20 47 65 74 51 44 57 69 |Origin =| GetQDWi|
|00001150| 6e 64 6f 77 4f 72 69 67 | 69 6e 28 77 69 6e 64 6f |ndowOrig|in(windo|
|00001160| 77 29 3b 0d 09 53 65 74 | 4f 72 69 67 69 6e 28 71 |w);..Set|Origin(q|
|00001170| 64 4f 72 69 67 69 6e 2e | 68 2c 20 71 64 4f 72 69 |dOrigin.|h, qdOri|
|00001180| 67 69 6e 2e 76 29 3b 0d | 09 0d 09 2f 2f 20 74 68 |gin.v);.|...// th|
|00001190| 65 20 71 64 20 6d 6f 75 | 73 65 20 69 73 20 63 6f |e qd mou|se is co|
|000011a0| 6e 76 65 72 74 65 64 20 | 66 72 6f 6d 20 61 20 76 |nverted |from a v|
|000011b0| 69 65 77 50 6f 72 74 20 | 6d 6f 75 73 65 2c 20 73 |iewPort |mouse, s|
|000011c0| 6f 0d 09 2f 2f 20 6e 6f | 20 6e 65 65 64 20 74 6f |o..// no| need to|
|000011d0| 20 61 64 6a 75 73 74 20 | 69 74 0d 09 46 69 78 65 | adjust |it..Fixe|
|000011e0| 64 50 6f 69 6e 74 54 6f | 53 68 6f 72 74 28 63 6c |dPointTo|Short(cl|
|000011f0| 69 63 6b 50 74 2c 20 26 | 71 64 43 6c 69 63 6b 29 |ickPt, &|qdClick)|
|00001200| 3b 0d 09 0d 09 69 66 28 | 63 6f 6e 73 74 72 61 69 |;....if(|constrai|
|00001210| 6e 74 20 3d 3d 20 76 41 | 78 69 73 4f 6e 6c 79 29 |nt == vA|xisOnly)|
|00001220| 0d 09 7b 0d 09 09 2f 2f | 20 47 65 74 20 61 20 72 |..{...//| Get a r|
|00001230| 67 6e 20 72 65 70 72 65 | 73 65 6e 74 69 6e 67 20 |gn repre|senting |
|00001240| 74 68 65 20 62 6f 75 6e | 64 73 20 6f 66 20 74 68 |the boun|ds of th|
|00001250| 65 20 6a 75 67 67 6c 65 | 72 0d 09 09 72 67 6e 20 |e juggle|r...rgn |
|00001260| 3d 20 47 65 74 53 68 61 | 70 65 42 6f 75 6e 64 73 |= GetSha|peBounds|
|00001270| 52 67 6e 28 6a 75 67 67 | 6c 65 72 50 69 63 74 29 |Rgn(jugg|lerPict)|
|00001280| 3b 0d 09 09 0d 09 09 2f | 2f 20 53 65 74 20 75 70 |;....../|/ Set up|
|00001290| 20 6c 69 6d 69 74 20 61 | 6e 64 20 73 6c 6f 70 20 | limit a|nd slop |
|000012a0| 72 65 63 74 73 0d 09 09 | 73 6c 6f 70 52 65 63 74 |rects...|slopRect|
|000012b0| 20 3d 20 77 69 6e 64 6f | 77 2d 3e 70 6f 72 74 52 | = windo|w->portR|
|000012c0| 65 63 74 3b 0d 09 09 47 | 65 74 53 68 61 70 65 42 |ect;...G|etShapeB|
|000012d0| 6f 75 6e 64 73 51 44 52 | 65 63 74 28 47 65 74 57 |oundsQDR|ect(GetW|
|000012e0| 69 6e 64 6f 77 47 58 53 | 68 61 70 65 28 77 69 6e |indowGXS|hape(win|
|000012f0| 64 6f 77 29 2c 20 26 6c | 69 6d 69 74 52 65 63 74 |dow), &l|imitRect|
|00001300| 29 3b 0d 09 7d 0d 09 65 | 6c 73 65 20 2f 2f 20 61 |);..}..e|lse // a|
|00001310| 73 73 75 6d 65 20 68 6f | 72 69 7a 6f 6e 74 61 6c |ssume ho|rizontal|
|00001320| 0d 09 7b 0d 09 09 2f 2f | 20 47 65 74 20 61 20 72 |..{...//| Get a r|
|00001330| 67 6e 20 72 65 70 72 65 | 73 65 6e 74 69 6e 67 20 |gn repre|senting |
|00001340| 74 68 65 20 62 6f 75 6e | 64 73 20 6f 66 20 61 20 |the boun|ds of a |
|00001350| 68 61 6e 64 0d 09 09 47 | 65 74 50 69 63 74 75 72 |hand...G|etPictur|
|00001360| 65 49 74 65 6d 28 6a 75 | 67 67 6c 65 72 50 69 63 |eItem(ju|gglerPic|
|00001370| 74 2c 20 32 2c 20 26 68 | 61 6e 64 2c 20 6e 69 6c |t, 2, &h|and, nil|
|00001380| 2c 20 6e 69 6c 2c 20 6e | 69 6c 29 3b 0d 09 09 68 |, nil, n|il);...h|
|00001390| 61 6e 64 20 3d 20 47 58 | 43 6f 70 79 54 6f 53 68 |and = GX|CopyToSh|
|000013a0| 61 70 65 28 6e 69 6c 2c | 20 68 61 6e 64 29 3b 0d |ape(nil,| hand);.|
|000013b0| 09 09 4d 6f 76 65 53 68 | 61 70 65 43 65 6e 74 65 |..MoveSh|apeCente|
|000013c0| 72 54 6f 28 68 61 6e 64 | 2c 20 63 6c 69 63 6b 50 |rTo(hand|, clickP|
|000013d0| 74 2d 3e 78 2c 20 63 6c | 69 63 6b 50 74 2d 3e 79 |t->x, cl|ickPt->y|
|000013e0| 29 3b 0d 09 09 72 67 6e | 20 3d 20 47 65 74 53 68 |);...rgn| = GetSh|
|000013f0| 61 70 65 42 6f 75 6e 64 | 73 52 67 6e 28 68 61 6e |apeBound|sRgn(han|
|00001400| 64 29 3b 0d 09 09 47 58 | 44 69 73 70 6f 73 65 53 |d);...GX|DisposeS|
|00001410| 68 61 70 65 28 68 61 6e | 64 29 3b 0d 09 09 0d 09 |hape(han|d);.....|
|00001420| 09 2f 2f 20 53 65 74 20 | 75 70 20 6c 69 6d 69 74 |.// Set |up limit|
|00001430| 20 61 6e 64 20 73 6c 6f | 70 20 72 65 63 74 73 0d | and slo|p rects.|
|00001440| 09 09 73 6c 6f 70 52 65 | 63 74 20 3d 20 77 69 6e |..slopRe|ct = win|
|00001450| 64 6f 77 2d 3e 70 6f 72 | 74 52 65 63 74 3b 0d 09 |dow->por|tRect;..|
|00001460| 09 6c 69 6d 69 74 52 65 | 63 74 20 3d 20 28 2a 72 |.limitRe|ct = (*r|
|00001470| 67 6e 29 2d 3e 72 67 6e | 42 42 6f 78 3b 0d 09 09 |gn)->rgn|BBox;...|
|00001480| 49 6e 73 65 74 52 65 63 | 74 28 26 6c 69 6d 69 74 |InsetRec|t(&limit|
|00001490| 52 65 63 74 2c 20 2d 73 | 68 6f 72 74 47 72 69 64 |Rect, -s|hortGrid|
|000014a0| 2e 68 2c 20 30 29 3b 0d | 09 7d 0d 09 0d 09 2f 2f |.h, 0);.|.}....//|
|000014b0| 20 64 72 61 67 20 74 68 | 65 20 72 67 6e 20 61 72 | drag th|e rgn ar|
|000014c0| 6f 75 6e 64 2c 20 67 72 | 69 64 64 65 64 0d 09 72 |ound, gr|idded..r|
|000014d0| 65 73 75 6c 74 50 74 20 | 3d 20 44 72 61 67 47 72 |esultPt |= DragGr|
|000014e0| 61 79 52 67 6e 47 72 69 | 64 64 65 64 28 72 67 6e |ayRgnGri|dded(rgn|
|000014f0| 2c 20 71 64 43 6c 69 63 | 6b 2c 0d 09 09 09 09 26 |, qdClic|k,.....&|
|00001500| 6c 69 6d 69 74 52 65 63 | 74 2c 20 26 73 6c 6f 70 |limitRec|t, &slop|
|00001510| 52 65 63 74 2c 20 63 6f | 6e 73 74 72 61 69 6e 74 |Rect, co|nstraint|
|00001520| 2c 20 73 68 6f 72 74 47 | 72 69 64 2c 20 6e 69 6c |, shortG|rid, nil|
|00001530| 29 3b 0d 09 09 09 09 0d | 09 2f 2f 20 43 6c 65 61 |);......|.// Clea|
|00001540| 6e 20 75 70 20 61 6e 64 | 20 72 65 73 74 6f 72 65 |n up and| restore|
|00001550| 20 6f 72 69 67 69 6e 0d | 09 44 69 73 70 6f 73 65 | origin.|.Dispose|
|00001560| 52 67 6e 28 72 67 6e 29 | 3b 0d 09 53 65 74 4f 72 |Rgn(rgn)|;..SetOr|
|00001570| 69 67 69 6e 28 30 2c 20 | 30 29 3b 0d 09 0d 09 2f |igin(0, |0);..../|
|00001580| 2f 20 53 65 65 20 77 68 | 61 74 20 68 61 70 70 65 |/ See wh|at happe|
|00001590| 6e 65 64 2e 20 49 66 20 | 74 68 65 20 64 72 61 67 |ned. If |the drag|
|000015a0| 20 65 6e 64 65 64 20 6f | 75 74 73 69 64 65 20 74 | ended o|utside t|
|000015b0| 68 65 20 73 6c 6f 70 72 | 65 63 74 2c 20 64 6f 20 |he slopr|ect, do |
|000015c0| 6e 6f 74 68 69 6e 67 0d | 09 69 66 28 72 65 73 75 |nothing.|.if(resu|
|000015d0| 6c 74 50 74 2e 68 20 21 | 3d 20 30 78 38 30 30 30 |ltPt.h !|= 0x8000|
|000015e0| 20 7c 7c 20 72 65 73 75 | 6c 74 50 74 2e 76 20 21 | || resu|ltPt.v !|
|000015f0| 3d 20 30 78 38 30 30 30 | 29 0d 09 7b 0d 09 09 2f |= 0x8000|)..{.../|
|00001600| 2f 20 4d 6f 76 65 20 74 | 68 65 20 6a 75 67 67 6c |/ Move t|he juggl|
|00001610| 65 72 20 61 70 70 72 6f | 70 72 69 61 74 65 6c 79 |er appro|priately|
|00001620| 0d 09 09 4d 6f 76 65 4a | 75 67 67 6c 65 72 28 61 |...MoveJ|uggler(a|
|00001630| 4a 75 67 67 6c 65 2c 20 | 77 68 69 63 68 4a 75 67 |Juggle, |whichJug|
|00001640| 67 6c 65 72 2c 20 72 65 | 73 75 6c 74 50 74 2e 76 |gler, re|sultPt.v|
|00001650| 20 2f 20 46 69 78 65 64 | 52 6f 75 6e 64 28 67 72 | / Fixed|Round(gr|
|00001660| 69 64 50 74 2e 79 29 29 | 3b 0d 09 09 0d 09 09 2f |idPt.y))|;....../|
|00001670| 2f 20 72 65 62 75 69 6c | 64 20 74 68 72 6f 77 73 |/ rebuil|d throws|
|00001680| 20 61 6e 64 20 66 6f 72 | 63 65 20 61 20 72 65 64 | and for|ce a red|
|00001690| 72 61 77 0d 09 09 52 65 | 62 75 69 6c 64 54 68 72 |raw...Re|buildThr|
|000016a0| 6f 77 73 50 69 63 74 28 | 61 4a 75 67 67 6c 65 29 |owsPict(|aJuggle)|
|000016b0| 3b 0d 09 09 53 65 74 50 | 6f 72 74 28 77 69 6e 64 |;...SetP|ort(wind|
|000016c0| 6f 77 29 3b 0d 09 09 45 | 72 61 73 65 52 65 63 74 |ow);...E|raseRect|
|000016d0| 28 26 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |(&window|->portRe|
|000016e0| 63 74 29 3b 0d 09 09 49 | 6e 76 61 6c 52 65 63 74 |ct);...I|nvalRect|
|000016f0| 28 26 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |(&window|->portRe|
|00001700| 63 74 29 3b 0d 09 7d 0d | 7d 0d 0d 2f 2f 20 54 68 |ct);..}.|}..// Th|
|00001710| 69 73 20 72 6f 75 74 69 | 6e 65 20 61 64 64 73 20 |is routi|ne adds |
|00001720| 61 20 6e 65 77 20 74 68 | 72 6f 77 20 73 68 61 70 |a new th|row shap|
|00001730| 65 2c 20 74 72 61 63 6b | 73 20 74 68 65 20 6d 6f |e, track|s the mo|
|00001740| 75 73 65 20 75 6e 74 69 | 6c 20 74 68 65 20 62 75 |use unti|l the bu|
|00001750| 74 74 6f 6e 20 69 73 20 | 72 65 6c 65 61 73 65 64 |tton is |released|
|00001760| 2c 0d 2f 2f 20 74 68 65 | 6e 20 61 64 64 73 20 74 |,.// the|n adds t|
|00001770| 68 65 20 6e 65 77 20 74 | 68 72 6f 77 20 74 6f 20 |he new t|hrow to |
|00001780| 74 68 65 20 63 6f 6e 6e | 65 63 74 69 6f 6e 73 20 |the conn|ections |
|00001790| 64 61 74 61 0d 76 6f 69 | 64 20 44 72 61 67 4e 65 |data.voi|d DragNe|
|000017a0| 77 54 68 72 6f 77 28 57 | 69 6e 64 6f 77 50 74 72 |wThrow(W|indowPtr|
|000017b0| 20 77 69 6e 64 6f 77 2c | 20 67 78 50 6f 69 6e 74 | window,| gxPoint|
|000017c0| 20 2a 66 72 6f 6d 29 0d | 7b 0d 09 4a 75 67 67 6c | *from).|{..Juggl|
|000017d0| 65 48 61 6e 64 6c 65 09 | 61 4a 75 67 67 6c 65 3b |eHandle.|aJuggle;|
|000017e0| 0d 09 67 78 4c 69 6e 65 | 09 09 09 6c 69 6e 65 3b |..gxLine|...line;|
|000017f0| 0d 09 67 78 50 6f 69 6e | 74 09 09 09 6a 75 67 67 |..gxPoin|t...jugg|
|00001800| 6c 65 72 47 72 69 64 3b | 0d 09 48 61 6e 64 4c 6f |lerGrid;|..HandLo|
|00001810| 63 09 09 09 64 65 73 74 | 4c 6f 63 2c 20 73 6f 75 |c...dest|Loc, sou|
|00001820| 72 63 65 4c 6f 63 3b 0d | 09 0d 09 61 4a 75 67 67 |rceLoc;.|...aJugg|
|00001830| 6c 65 20 3d 20 47 65 74 | 57 69 6e 64 6f 77 4a 75 |le = Get|WindowJu|
|00001840| 67 67 6c 65 28 77 69 6e | 64 6f 77 29 3b 0d 09 6a |ggle(win|dow);..j|
|00001850| 75 67 67 6c 65 72 47 72 | 69 64 20 3d 20 28 2a 61 |ugglerGr|id = (*a|
|00001860| 4a 75 67 67 6c 65 29 2d | 3e 67 72 69 64 50 74 3b |Juggle)-|>gridPt;|
|00001870| 0d 09 0d 09 2f 2f 20 46 | 6f 72 63 65 20 73 74 61 |....// F|orce sta|
|00001880| 72 74 69 6e 67 20 67 65 | 6f 6d 65 74 72 79 20 74 |rting ge|ometry t|
|00001890| 6f 20 74 68 65 20 6e 65 | 61 72 65 73 74 20 67 72 |o the ne|arest gr|
|000018a0| 69 64 20 70 6f 69 6e 74 | 0d 09 44 65 74 65 6e 74 |id point|..Detent|
|000018b0| 28 66 72 6f 6d 2c 20 26 | 6a 75 67 67 6c 65 72 47 |(from, &|jugglerG|
|000018c0| 72 69 64 2c 20 6a 75 67 | 67 6c 65 72 47 72 69 64 |rid, jug|glerGrid|
|000018d0| 2e 78 20 2f 20 32 29 3b | 0d 09 6c 69 6e 65 2e 66 |.x / 2);|..line.f|
|000018e0| 69 72 73 74 20 3d 20 6c | 69 6e 65 2e 6c 61 73 74 |irst = l|ine.last|
|000018f0| 20 3d 20 2a 66 72 6f 6d | 3b 0d 09 0d 09 2f 2f 20 | = *from|;....// |
|00001900| 43 6f 6e 76 65 72 74 20 | 70 6f 69 6e 74 20 74 6f |Convert |point to|
|00001910| 20 68 61 6e 64 20 6c 6f | 63 61 74 69 6f 6e 0d 09 | hand lo|cation..|
|00001920| 50 6f 69 6e 74 54 6f 48 | 61 6e 64 4c 6f 63 28 61 |PointToH|andLoc(a|
|00001930| 4a 75 67 67 6c 65 2c 20 | 26 6c 69 6e 65 2e 66 69 |Juggle, |&line.fi|
|00001940| 72 73 74 2c 20 26 73 6f | 75 72 63 65 4c 6f 63 2c |rst, &so|urceLoc,|
|00001950| 20 66 61 6c 73 65 29 3b | 0d 09 69 66 28 73 6f 75 | false);|..if(sou|
|00001960| 72 63 65 4c 6f 63 2e 74 | 69 6d 65 20 3e 20 30 29 |rceLoc.t|ime > 0)|
|00001970| 0d 09 7b 0d 09 09 2f 2f | 20 4c 6f 6f 6b 20 66 6f |..{...//| Look fo|
|00001980| 72 20 74 68 65 20 6e 65 | 61 72 65 73 74 20 6c 65 |r the ne|arest le|
|00001990| 67 61 6c 20 72 65 63 65 | 69 76 65 72 0d 09 09 64 |gal rece|iver...d|
|000019a0| 65 73 74 4c 6f 63 20 3d | 20 46 69 6e 64 52 65 63 |estLoc =| FindRec|
|000019b0| 65 69 76 65 72 28 61 4a | 75 67 67 6c 65 2c 20 73 |eiver(aJ|uggle, s|
|000019c0| 6f 75 72 63 65 4c 6f 63 | 29 3b 0d 09 09 69 66 28 |ourceLoc|);...if(|
|000019d0| 64 65 73 74 4c 6f 63 2e | 74 69 6d 65 20 3e 20 30 |destLoc.|time > 0|
|000019e0| 29 0d 09 09 7b 0d 09 09 | 09 2f 2f 20 53 65 74 20 |)...{...|.// Set |
|000019f0| 6e 65 77 20 72 65 63 65 | 69 76 65 72 20 61 73 20 |new rece|iver as |
|00001a00| 74 68 65 20 6c 69 6e 65 | 27 73 20 65 6e 64 2e 0d |the line|'s end..|
|00001a10| 09 09 09 48 61 6e 64 4c | 6f 63 54 6f 50 6f 69 6e |...HandL|ocToPoin|
|00001a20| 74 28 61 4a 75 67 67 6c | 65 2c 20 26 64 65 73 74 |t(aJuggl|e, &dest|
|00001a30| 4c 6f 63 2c 20 26 6c 69 | 6e 65 2e 6c 61 73 74 29 |Loc, &li|ne.last)|
|00001a40| 3b 0d 09 09 09 0d 09 09 | 09 2f 2f 20 4d 61 6b 65 |;.......|.// Make|
|00001a50| 20 69 74 20 61 20 70 72 | 65 73 65 6e 74 61 62 6c | it a pr|esentabl|
|00001a60| 65 20 6c 69 6e 65 2c 20 | 6f 66 66 20 74 68 65 20 |e line, |off the |
|00001a70| 68 61 6e 64 20 61 20 62 | 69 74 0d 09 09 09 6c 69 |hand a b|it....li|
|00001a80| 6e 65 2e 66 69 72 73 74 | 2e 78 20 2b 3d 20 6b 48 |ne.first|.x += kH|
|00001a90| 61 6e 64 52 61 64 69 75 | 73 3b 0d 09 09 09 6c 69 |andRadiu|s;....li|
|00001aa0| 6e 65 2e 6c 61 73 74 2e | 78 20 2d 3d 20 6b 48 61 |ne.last.|x -= kHa|
|00001ab0| 6e 64 52 61 64 69 75 73 | 3b 0d 09 09 09 09 0d 09 |ndRadius|;.......|
|00001ac0| 09 09 2f 2f 20 41 64 64 | 20 74 68 65 20 6e 65 77 |..// Add| the new|
|00001ad0| 20 74 68 72 6f 77 20 74 | 6f 20 74 68 65 20 74 68 | throw t|o the th|
|00001ae0| 72 6f 77 73 20 70 69 63 | 74 2c 20 61 6e 64 20 64 |rows pic|t, and d|
|00001af0| 72 61 77 20 69 74 0d 09 | 09 09 41 64 64 4e 65 77 |raw it..|..AddNew|
|00001b00| 54 68 72 6f 77 53 68 61 | 70 65 28 61 4a 75 67 67 |ThrowSha|pe(aJugg|
|00001b10| 6c 65 2c 20 26 6c 69 6e | 65 2c 20 74 72 75 65 29 |le, &lin|e, true)|
|00001b20| 3b 0d 09 09 09 0d 09 09 | 09 2f 2f 20 41 64 64 20 |;.......|.// Add |
|00001b30| 74 6f 20 63 6f 6e 6e 65 | 63 74 69 6f 6e 73 20 64 |to conne|ctions d|
|00001b40| 61 74 61 20 74 6f 20 73 | 74 61 72 74 0d 09 09 09 |ata to s|tart....|
|00001b50| 4c 69 6e 65 54 6f 41 64 | 64 65 64 54 68 72 6f 77 |LineToAd|dedThrow|
|00001b60| 28 61 4a 75 67 67 6c 65 | 2c 20 26 6c 69 6e 65 29 |(aJuggle|, &line)|
|00001b70| 3b 0d 09 09 09 0d 09 09 | 09 2f 2f 20 54 72 61 63 |;.......|.// Trac|
|00001b80| 6b 20 74 68 65 20 64 72 | 61 67 3a 20 74 68 65 20 |k the dr|ag: the |
|00001b90| 61 72 72 6f 77 20 69 73 | 20 69 6e 64 65 78 20 31 |arrow is| index 1|
|00001ba0| 20 69 6e 20 74 68 65 20 | 70 69 63 74 75 72 65 2c | in the |picture,|
|00001bb0| 20 77 65 27 72 65 20 64 | 72 61 67 67 69 6e 67 20 | we're d|ragging |
|00001bc0| 74 68 65 20 61 72 72 6f | 77 20 68 65 61 64 0d 09 |the arro|w head..|
|00001bd0| 09 09 44 72 61 67 54 68 | 72 6f 77 28 61 4a 75 67 |..DragTh|row(aJug|
|00001be0| 67 6c 65 2c 20 31 2c 20 | 32 2c 20 66 72 6f 6d 29 |gle, 1, |2, from)|
|00001bf0| 3b 0d 09 09 7d 0d 09 09 | 65 6c 73 65 0d 09 09 09 |;...}...|else....|
|00001c00| 53 79 73 42 65 65 70 28 | 31 30 29 3b 20 2f 2f 20 |SysBeep(|10); // |
|00001c10| 4e 6f 20 6c 65 67 61 6c | 20 72 65 63 65 69 76 65 |No legal| receive|
|00001c20| 72 0d 09 7d 0d 09 65 6c | 73 65 0d 09 09 53 79 73 |r..}..el|se...Sys|
|00001c30| 42 65 65 70 28 31 30 29 | 3b 20 2f 2f 20 70 6f 69 |Beep(10)|; // poi|
|00001c40| 6e 74 20 69 73 6e 27 74 | 20 6f 6e 20 61 20 68 61 |nt isn't| on a ha|
|00001c50| 6e 64 0d 7d 0d 0d 2f 2f | 20 44 72 61 67 20 74 68 |nd.}..//| Drag th|
|00001c60| 65 20 74 68 72 6f 77 20 | 62 79 20 74 68 65 20 69 |e throw |by the i|
|00001c70| 6e 64 69 63 61 74 65 64 | 20 70 6f 69 6e 74 3a 20 |ndicated| point: |
|00001c80| 31 20 69 73 20 66 69 72 | 73 74 2c 20 32 20 69 73 |1 is fir|st, 2 is|
|00001c90| 20 6c 61 73 74 2e 0d 2f | 2f 20 41 73 73 75 6d 65 | last../|/ Assume|
|00001ca0| 73 20 74 68 61 74 20 74 | 68 65 20 74 72 61 6e 73 |s that t|he trans|
|00001cb0| 66 65 72 20 6d 6f 64 65 | 20 69 73 20 78 6f 72 0d |fer mode| is xor.|
|00001cc0| 76 6f 69 64 20 44 72 61 | 67 54 68 72 6f 77 28 4a |void Dra|gThrow(J|
|00001cd0| 75 67 67 6c 65 48 61 6e | 64 6c 65 20 61 4a 75 67 |uggleHan|dle aJug|
|00001ce0| 67 6c 65 2c 20 6c 6f 6e | 67 20 73 68 61 70 65 49 |gle, lon|g shapeI|
|00001cf0| 6e 64 65 78 2c 0d 09 09 | 09 09 09 6c 6f 6e 67 20 |ndex,...|...long |
|00001d00| 77 68 69 63 68 50 6f 69 | 6e 74 2c 20 67 78 50 6f |whichPoi|nt, gxPo|
|00001d10| 69 6e 74 20 2a 66 72 6f | 6d 29 0d 7b 0d 09 67 78 |int *fro|m).{..gx|
|00001d20| 4c 69 6e 65 09 09 6c 69 | 6e 65 44 61 74 61 3b 0d |Line..li|neData;.|
|00001d30| 09 67 78 53 68 61 70 65 | 09 09 74 68 72 6f 77 53 |.gxShape|..throwS|
|00001d40| 68 61 70 65 3b 0d 09 67 | 78 50 6f 69 6e 74 09 09 |hape;..g|xPoint..|
|00001d50| 72 61 77 50 74 2c 20 67 | 6f 6f 64 50 74 2c 20 6c |rawPt, g|oodPt, l|
|00001d60| 61 73 74 50 74 2c 20 6c | 61 73 74 47 6f 6f 64 50 |astPt, l|astGoodP|
|00001d70| 74 2c 20 64 65 74 65 6e | 74 47 72 69 64 3b 0d 09 |t, deten|tGrid;..|
|00001d80| 46 69 78 65 64 09 09 68 | 61 6e 64 52 61 64 69 75 |Fixed..h|andRadiu|
|00001d90| 73 2c 20 74 77 6f 48 61 | 6e 64 73 3b 0d 09 67 78 |s, twoHa|nds;..gx|
|00001da0| 56 69 65 77 50 6f 72 74 | 09 70 6f 72 74 3b 0d 09 |ViewPort|.port;..|
|00001db0| 42 6f 6f 6c 65 61 6e 09 | 09 6c 65 67 61 6c 54 68 |Boolean.|.legalTh|
|00001dc0| 72 6f 77 3b 0d 09 0d 09 | 2f 2f 20 69 6e 69 74 20 |row;....|// init |
|00001dd0| 73 6f 6d 65 20 76 61 72 | 69 61 62 6c 65 73 0d 09 |some var|iables..|
|00001de0| 64 65 74 65 6e 74 47 72 | 69 64 20 3d 20 28 2a 61 |detentGr|id = (*a|
|00001df0| 4a 75 67 67 6c 65 29 2d | 3e 67 72 69 64 50 74 3b |Juggle)-|>gridPt;|
|00001e00| 0d 09 70 6f 72 74 20 3d | 20 28 2a 61 4a 75 67 67 |..port =| (*aJugg|
|00001e10| 6c 65 29 2d 3e 64 6f 63 | 50 6f 72 74 3b 0d 09 6c |le)->doc|Port;..l|
|00001e20| 65 67 61 6c 54 68 72 6f | 77 20 3d 20 74 72 75 65 |egalThro|w = true|
|00001e30| 3b 20 2f 2f 20 54 68 65 | 20 74 68 72 6f 77 20 73 |; // The| throw s|
|00001e40| 74 61 72 74 73 20 6f 66 | 66 20 6c 65 67 61 6c 20 |tarts of|f legal |
|00001e50| 62 79 20 64 65 66 69 6e | 69 74 69 6f 6e 0d 09 68 |by defin|ition..h|
|00001e60| 61 6e 64 52 61 64 69 75 | 73 20 3d 20 6b 48 61 6e |andRadiu|s = kHan|
|00001e70| 64 52 61 64 69 75 73 3b | 0d 09 74 77 6f 48 61 6e |dRadius;|..twoHan|
|00001e80| 64 73 20 3d 20 32 20 2a | 20 68 61 6e 64 52 61 64 |ds = 2 *| handRad|
|00001e90| 69 75 73 3b 0d 09 0d 09 | 2f 2f 20 47 65 74 20 63 |ius;....|// Get c|
|00001ea0| 75 72 72 65 6e 74 20 6d | 6f 75 73 65 2c 20 73 65 |urrent m|ouse, se|
|00001eb0| 74 20 73 74 61 72 74 69 | 6e 67 20 70 6f 73 69 74 |t starti|ng posit|
|00001ec0| 69 6f 6e 73 0d 09 47 58 | 47 65 74 56 69 65 77 50 |ions..GX|GetViewP|
|00001ed0| 6f 72 74 4d 6f 75 73 65 | 28 70 6f 72 74 2c 20 26 |ortMouse|(port, &|
|00001ee0| 72 61 77 50 74 29 3b 0d | 09 6c 61 73 74 50 74 20 |rawPt);.|.lastPt |
|00001ef0| 3d 20 6c 61 73 74 47 6f | 6f 64 50 74 20 3d 20 72 |= lastGo|odPt = r|
|00001f00| 61 77 50 74 3b 0d 09 4b | 65 65 70 50 74 49 6e 42 |awPt;..K|eepPtInB|
|00001f10| 6f 75 6e 64 73 28 61 4a | 75 67 67 6c 65 2c 20 26 |ounds(aJ|uggle, &|
|00001f20| 6c 61 73 74 47 6f 6f 64 | 50 74 29 3b 0d 09 0d 09 |lastGood|Pt);....|
|00001f30| 2f 2f 20 47 65 74 20 74 | 68 65 20 67 65 6f 6d 65 |// Get t|he geome|
|00001f40| 74 72 79 20 6f 66 20 74 | 68 65 20 74 68 72 6f 77 |try of t|he throw|
|00001f50| 0d 09 47 65 74 50 69 63 | 74 75 72 65 49 74 65 6d |..GetPic|tureItem|
|00001f60| 28 28 2a 61 4a 75 67 67 | 6c 65 29 2d 3e 74 68 72 |((*aJugg|le)->thr|
|00001f70| 6f 77 73 50 69 63 74 2c | 20 73 68 61 70 65 49 6e |owsPict,| shapeIn|
|00001f80| 64 65 78 2c 20 26 74 68 | 72 6f 77 53 68 61 70 65 |dex, &th|rowShape|
|00001f90| 2c 20 6e 69 6c 2c 20 6e | 69 6c 2c 20 6e 69 6c 29 |, nil, n|il, nil)|
|00001fa0| 3b 0d 09 47 58 47 65 74 | 4c 69 6e 65 28 74 68 72 |;..GXGet|Line(thr|
|00001fb0| 6f 77 53 68 61 70 65 2c | 20 26 6c 69 6e 65 44 61 |owShape,| &lineDa|
|00001fc0| 74 61 29 3b 0d 09 0d 09 | 2f 2f 20 52 65 6d 6f 76 |ta);....|// Remov|
|00001fd0| 65 20 69 74 20 66 72 6f | 6d 20 74 68 65 20 63 6f |e it fro|m the co|
|00001fe0| 6e 6e 65 63 74 69 6f 6e | 73 20 64 61 74 61 20 77 |nnection|s data w|
|00001ff0| 68 69 6c 65 20 64 72 61 | 67 67 69 6e 67 0d 09 4c |hile dra|gging..L|
|00002000| 69 6e 65 54 6f 52 65 6d | 6f 76 65 64 54 68 72 6f |ineToRem|ovedThro|
|00002010| 77 28 61 4a 75 67 67 6c | 65 2c 20 26 6c 69 6e 65 |w(aJuggl|e, &line|
|00002020| 44 61 74 61 29 3b 0d 09 | 0d 09 2f 2f 20 54 72 61 |Data);..|..// Tra|
|00002030| 63 6b 20 74 68 65 20 6d | 6f 75 73 65 2c 20 65 72 |ck the m|ouse, er|
|00002040| 61 73 69 6e 67 20 61 6e | 64 20 72 65 64 72 61 77 |asing an|d redraw|
|00002050| 69 6e 67 0d 09 77 68 69 | 6c 65 28 53 74 69 6c 6c |ing..whi|le(Still|
|00002060| 44 6f 77 6e 28 29 29 0d | 09 7b 0d 09 09 2f 2f 20 |Down()).|.{...// |
|00002070| 47 65 74 20 74 68 65 20 | 6e 65 77 20 6d 6f 75 73 |Get the |new mous|
|00002080| 65 20 70 6f 73 69 74 69 | 6f 6e 20 61 6e 64 20 69 |e positi|on and i|
|00002090| 66 20 69 74 27 73 20 64 | 69 66 66 65 72 65 6e 74 |f it's d|ifferent|
|000020a0| 2c 0d 09 09 2f 2f 20 61 | 64 6a 75 73 74 20 74 68 |,...// a|djust th|
|000020b0| 65 20 64 72 61 67 67 65 | 64 20 73 68 61 70 65 0d |e dragge|d shape.|
|000020c0| 09 09 47 58 47 65 74 56 | 69 65 77 50 6f 72 74 4d |..GXGetV|iewPortM|
|000020d0| 6f 75 73 65 28 70 6f 72 | 74 2c 20 26 72 61 77 50 |ouse(por|t, &rawP|
|000020e0| 74 29 3b 0d 09 09 69 66 | 28 72 61 77 50 74 2e 78 |t);...if|(rawPt.x|
|000020f0| 20 21 3d 20 6c 61 73 74 | 50 74 2e 78 20 7c 7c 20 | != last|Pt.x || |
|00002100| 72 61 77 50 74 2e 79 20 | 21 3d 20 6c 61 73 74 50 |rawPt.y |!= lastP|
|00002110| 74 2e 79 29 0d 09 09 7b | 0d 09 09 09 48 61 6e 64 |t.y)...{|....Hand|
|00002120| 50 74 72 09 68 61 6e 64 | 20 3d 20 6e 69 6c 3b 0d |Ptr.hand| = nil;.|
|00002130| 09 09 09 46 69 78 65 64 | 09 6d 61 78 4c 65 6e 67 |...Fixed|.maxLeng|
|00002140| 74 68 2c 20 6d 69 6e 4c | 65 6e 67 74 68 3b 0d 09 |th, minL|ength;..|
|00002150| 09 09 0d 09 09 09 2f 2f | 20 61 73 73 75 6d 65 20 |......//| assume |
|00002160| 69 6c 6c 65 67 61 6c 20 | 74 68 72 6f 77 0d 09 09 |illegal |throw...|
|00002170| 09 6c 65 67 61 6c 54 68 | 72 6f 77 20 3d 20 66 61 |.legalTh|row = fa|
|00002180| 6c 73 65 3b 0d 09 09 09 | 0d 09 09 09 2f 2f 20 6d |lse;....|....// m|
|00002190| 61 78 20 6c 69 6e 65 20 | 6c 65 6e 67 74 68 20 69 |ax line |length i|
|000021a0| 73 20 6f 6e 65 20 63 79 | 63 6c 65 20 6d 69 6e 75 |s one cy|cle minu|
|000021b0| 73 20 32 20 68 61 6e 64 | 73 0d 09 09 09 6d 61 78 |s 2 hand|s....max|
|000021c0| 4c 65 6e 67 74 68 20 3d | 20 28 64 65 74 65 6e 74 |Length =| (detent|
|000021d0| 47 72 69 64 2e 78 20 2a | 20 28 28 2a 61 4a 75 67 |Grid.x *| ((*aJug|
|000021e0| 67 6c 65 29 2d 3e 6e 75 | 6d 43 6f 75 6e 74 73 29 |gle)->nu|mCounts)|
|000021f0| 29 20 2d 20 74 77 6f 48 | 61 6e 64 73 3b 0d 09 09 |) - twoH|ands;...|
|00002200| 09 0d 09 09 09 2f 2f 20 | 6d 69 6e 20 6c 65 6e 67 |.....// |min leng|
|00002210| 74 68 20 69 73 20 6f 6e | 65 20 67 72 69 64 20 6d |th is on|e grid m|
|00002220| 69 6e 75 73 20 32 20 68 | 61 6e 64 73 0d 09 09 09 |inus 2 h|ands....|
|00002230| 6d 69 6e 4c 65 6e 67 74 | 68 20 3d 20 64 65 74 65 |minLengt|h = dete|
|00002240| 6e 74 47 72 69 64 2e 78 | 20 2d 20 74 77 6f 48 61 |ntGrid.x| - twoHa|
|00002250| 6e 64 73 3b 0d 0d 09 09 | 09 2f 2f 20 6b 65 65 70 |nds;....|.// keep|
|00002260| 20 74 68 65 20 70 6f 69 | 6e 74 20 69 6e 20 62 6f | the poi|nt in bo|
|00002270| 75 6e 64 73 0d 09 09 09 | 67 6f 6f 64 50 74 20 3d |unds....|goodPt =|
|00002280| 20 72 61 77 50 74 3b 0d | 09 09 09 4b 65 65 70 50 | rawPt;.|...KeepP|
|00002290| 74 49 6e 42 6f 75 6e 64 | 73 28 61 4a 75 67 67 6c |tInBound|s(aJuggl|
|000022a0| 65 2c 20 26 67 6f 6f 64 | 50 74 29 3b 0d 09 09 09 |e, &good|Pt);....|
|000022b0| 0d 09 09 09 2f 2f 20 64 | 72 61 67 67 69 6e 67 20 |....// d|ragging |
|000022c0| 74 68 65 20 74 61 69 6c | 0d 09 09 09 69 66 28 77 |the tail|....if(w|
|000022d0| 68 69 63 68 50 6f 69 6e | 74 20 3d 3d 20 31 29 0d |hichPoin|t == 1).|
|000022e0| 09 09 09 7b 0d 09 09 09 | 09 2f 2f 20 74 61 69 6c |...{....|.// tail|
|000022f0| 20 70 6f 69 6e 74 2c 20 | 6d 75 73 74 20 62 65 20 | point, |must be |
|00002300| 65 61 72 6c 69 65 72 20 | 69 6e 20 74 69 6d 65 20 |earlier |in time |
|00002310| 74 68 61 6e 20 6c 69 6e | 65 27 73 20 6c 61 73 74 |than lin|e's last|
|00002320| 20 70 6f 69 6e 74 0d 09 | 09 09 09 2f 2f 20 62 79 | point..|...// by|
|00002330| 20 61 74 20 6c 65 61 73 | 74 20 6d 69 6e 4c 65 6e | at leas|t minLen|
|00002340| 67 74 68 0d 09 09 09 09 | 69 66 28 67 6f 6f 64 50 |gth.....|if(goodP|
|00002350| 74 2e 78 20 3e 20 6c 69 | 6e 65 44 61 74 61 2e 6c |t.x > li|neData.l|
|00002360| 61 73 74 2e 78 20 2d 20 | 6d 69 6e 4c 65 6e 67 74 |ast.x - |minLengt|
|00002370| 68 20 29 0d 09 09 09 09 | 09 67 6f 6f 64 50 74 2e |h ).....|.goodPt.|
|00002380| 78 20 3d 20 6c 69 6e 65 | 44 61 74 61 2e 6c 61 73 |x = line|Data.las|
|00002390| 74 2e 78 20 2d 20 6d 69 | 6e 4c 65 6e 67 74 68 3b |t.x - mi|nLength;|
|000023a0| 0d 09 09 09 09 2f 2f 20 | 61 6e 64 20 6c 69 6e 65 |.....// |and line|
|000023b0| 20 6e 6f 74 20 6c 6f 6e | 67 65 72 20 74 68 61 6e | not lon|ger than|
|000023c0| 20 6d 61 78 4c 65 6e 67 | 74 68 0d 09 09 09 09 65 | maxLeng|th.....e|
|000023d0| 6c 73 65 20 69 66 28 67 | 6f 6f 64 50 74 2e 78 20 |lse if(g|oodPt.x |
|000023e0| 3c 20 6c 69 6e 65 44 61 | 74 61 2e 6c 61 73 74 2e |< lineDa|ta.last.|
|000023f0| 78 20 2d 20 6d 61 78 4c | 65 6e 67 74 68 29 0d 09 |x - maxL|ength)..|
|00002400| 09 09 09 09 67 6f 6f 64 | 50 74 2e 78 20 3d 20 6c |....good|Pt.x = l|
|00002410| 69 6e 65 44 61 74 61 2e | 6c 61 73 74 2e 78 20 2d |ineData.|last.x -|
|00002420| 20 6d 61 78 4c 65 6e 67 | 74 68 3b 0d 09 09 09 09 | maxLeng|th;.....|
|00002430| 09 0d 09 09 09 09 2f 2f | 20 61 6c 73 6f 20 6d 75 |......//| also mu|
|00002440| 73 74 20 73 74 61 79 20 | 69 6e 20 72 61 6e 67 65 |st stay |in range|
|00002450| 3a 20 74 68 72 6f 77 73 | 20 4d 55 53 54 20 6f 72 |: throws| MUST or|
|00002460| 69 67 69 6e 61 74 65 0d | 09 09 09 09 2f 2f 20 66 |iginate.|....// f|
|00002470| 72 6f 6d 20 69 6e 73 69 | 64 65 20 74 68 65 20 75 |rom insi|de the u|
|00002480| 6e 66 61 64 65 64 20 70 | 61 72 74 73 0d 09 09 09 |nfaded p|arts....|
|00002490| 09 69 66 28 67 6f 6f 64 | 50 74 2e 78 20 3e 20 6d |.if(good|Pt.x > m|
|000024a0| 61 78 4c 65 6e 67 74 68 | 29 0d 09 09 09 09 09 67 |axLength|)......g|
|000024b0| 6f 6f 64 50 74 2e 78 20 | 3d 20 6d 61 78 4c 65 6e |oodPt.x |= maxLen|
|000024c0| 67 74 68 3b 0d 09 09 09 | 09 0d 09 09 09 09 6c 69 |gth;....|......li|
|000024d0| 6e 65 44 61 74 61 2e 66 | 69 72 73 74 20 3d 20 67 |neData.f|irst = g|
|000024e0| 6f 6f 64 50 74 3b 20 2f | 2f 20 75 73 65 20 74 68 |oodPt; /|/ use th|
|000024f0| 69 73 20 70 6f 69 6e 74 | 0d 09 09 09 7d 0d 09 09 |is point|....}...|
|00002500| 09 65 6c 73 65 20 2f 2f | 20 64 72 61 67 67 69 6e |.else //| draggin|
|00002510| 67 20 61 72 72 6f 77 20 | 68 65 61 64 0d 09 09 09 |g arrow |head....|
|00002520| 7b 0d 09 09 09 09 2f 2f | 20 68 65 61 64 20 6d 75 |{.....//| head mu|
|00002530| 73 74 20 62 65 20 6c 61 | 74 65 72 20 69 6e 20 74 |st be la|ter in t|
|00002540| 69 6d 65 20 74 68 61 6e | 20 6c 69 6e 65 27 73 20 |ime than| line's |
|00002550| 66 69 72 73 74 20 70 6f | 69 6e 74 20 0d 09 09 09 |first po|int ....|
|00002560| 09 2f 2f 20 62 79 20 61 | 74 20 6c 65 61 73 74 20 |.// by a|t least |
|00002570| 6d 69 6e 4c 65 6e 67 74 | 68 0d 09 09 09 09 69 66 |minLengt|h.....if|
|00002580| 28 67 6f 6f 64 50 74 2e | 78 20 3c 20 6c 69 6e 65 |(goodPt.|x < line|
|00002590| 44 61 74 61 2e 66 69 72 | 73 74 2e 78 20 2b 20 6d |Data.fir|st.x + m|
|000025a0| 69 6e 4c 65 6e 67 74 68 | 29 0d 09 09 09 09 09 67 |inLength|)......g|
|000025b0| 6f 6f 64 50 74 2e 78 20 | 3d 20 6c 69 6e 65 44 61 |oodPt.x |= lineDa|
|000025c0| 74 61 2e 66 69 72 73 74 | 2e 78 20 2b 20 6d 69 6e |ta.first|.x + min|
|000025d0| 4c 65 6e 67 74 68 3b 0d | 09 09 09 09 0d 09 09 09 |Length;.|........|
|000025e0| 09 2f 2f 20 62 75 74 20 | 6e 6f 74 20 6c 6f 6e 67 |.// but |not long|
|000025f0| 65 72 20 74 68 61 6e 20 | 6d 61 78 4c 65 6e 67 74 |er than |maxLengt|
|00002600| 68 0d 09 09 09 09 65 6c | 73 65 20 69 66 28 67 6f |h.....el|se if(go|
|00002610| 6f 64 50 74 2e 78 20 3e | 20 6c 69 6e 65 44 61 74 |odPt.x >| lineDat|
|00002620| 61 2e 66 69 72 73 74 2e | 78 20 2b 20 6d 61 78 4c |a.first.|x + maxL|
|00002630| 65 6e 67 74 68 29 0d 09 | 09 09 09 09 67 6f 6f 64 |ength)..|....good|
|00002640| 50 74 2e 78 20 3d 20 6c | 69 6e 65 44 61 74 61 2e |Pt.x = l|ineData.|
|00002650| 66 69 72 73 74 2e 78 20 | 2b 20 6d 61 78 4c 65 6e |first.x |+ maxLen|
|00002660| 67 74 68 3b 0d 09 09 09 | 09 0d 09 09 09 09 6c 69 |gth;....|......li|
|00002670| 6e 65 44 61 74 61 2e 6c | 61 73 74 20 3d 20 67 6f |neData.l|ast = go|
|00002680| 6f 64 50 74 3b 20 2f 2f | 20 75 73 65 20 74 68 69 |odPt; //| use thi|
|00002690| 73 20 70 6f 69 6e 74 0d | 09 09 09 7d 0d 09 09 09 |s point.|...}....|
|000026a0| 0d 09 09 09 2f 2f 20 43 | 68 65 63 6b 20 69 66 20 |....// C|heck if |
|000026b0| 69 74 27 73 20 6e 65 61 | 72 20 61 20 67 72 69 64 |it's nea|r a grid|
|000026c0| 20 70 6f 69 6e 74 0d 09 | 09 09 69 66 28 44 65 74 | point..|..if(Det|
|000026d0| 65 6e 74 28 26 67 6f 6f | 64 50 74 2c 20 26 64 65 |ent(&goo|dPt, &de|
|000026e0| 74 65 6e 74 47 72 69 64 | 2c 20 6b 54 68 72 6f 77 |tentGrid|, kThrow|
|000026f0| 44 65 74 65 6e 74 29 29 | 0d 09 09 09 7b 0d 09 09 |Detent))|....{...|
|00002700| 09 09 2f 2f 20 49 74 20 | 69 73 2c 20 67 65 74 20 |..// It |is, get |
|00002710| 74 68 65 20 68 61 6e 64 | 0d 09 09 09 09 68 61 6e |the hand|.....han|
|00002720| 64 20 3d 20 50 6f 69 6e | 74 54 6f 48 61 6e 64 28 |d = Poin|tToHand(|
|00002730| 61 4a 75 67 67 6c 65 2c | 20 26 67 6f 6f 64 50 74 |aJuggle,| &goodPt|
|00002740| 2c 20 74 72 75 65 29 3b | 0d 09 09 09 09 69 66 28 |, true);|.....if(|
|00002750| 68 61 6e 64 20 21 3d 20 | 30 29 0d 09 09 09 09 7b |hand != |0).....{|
|00002760| 0d 09 09 09 09 09 69 66 | 28 77 68 69 63 68 50 6f |......if|(whichPo|
|00002770| 69 6e 74 20 3d 3d 20 31 | 29 20 2f 2f 20 69 66 20 |int == 1|) // if |
|00002780| 64 72 61 67 67 69 6e 67 | 20 74 61 69 6c 0d 09 09 |dragging| tail...|
|00002790| 09 09 09 7b 0d 09 09 09 | 09 09 09 69 66 28 68 61 |...{....|...if(ha|
|000027a0| 6e 64 2d 3e 73 69 6e 6b | 2e 74 69 6d 65 20 3d 3d |nd->sink|.time ==|
|000027b0| 20 30 29 20 2f 2f 20 61 | 6e 64 20 68 61 6e 64 20 | 0) // a|nd hand |
|000027c0| 6e 65 65 64 73 20 61 20 | 73 69 6e 6b 0d 09 09 09 |needs a |sink....|
|000027d0| 09 09 09 7b 0d 09 09 09 | 09 09 09 09 6c 69 6e 65 |...{....|....line|
|000027e0| 44 61 74 61 2e 66 69 72 | 73 74 20 3d 20 67 6f 6f |Data.fir|st = goo|
|000027f0| 64 50 74 3b 20 2f 2f 20 | 4c 65 67 61 6c 20 63 68 |dPt; // |Legal ch|
|00002800| 61 6e 67 65 2c 20 73 6f | 20 63 68 61 6e 67 65 20 |ange, so| change |
|00002810| 69 74 0d 09 09 09 09 09 | 09 09 6c 69 6e 65 44 61 |it......|..lineDa|
|00002820| 74 61 2e 66 69 72 73 74 | 2e 78 20 2b 3d 20 68 61 |ta.first|.x += ha|
|00002830| 6e 64 52 61 64 69 75 73 | 3b 20 20 2f 2f 20 67 65 |ndRadius|; // ge|
|00002840| 74 20 69 74 20 6f 66 66 | 20 74 68 65 20 68 61 6e |t it off| the han|
|00002850| 64 0d 09 09 09 09 09 09 | 09 6c 65 67 61 6c 54 68 |d.......|.legalTh|
|00002860| 72 6f 77 20 3d 20 74 72 | 75 65 3b 0d 09 09 09 09 |row = tr|ue;.....|
|00002870| 09 09 7d 0d 09 09 09 09 | 09 09 65 6c 73 65 0d 09 |..}.....|..else..|
|00002880| 09 09 09 09 09 7b 0d 09 | 09 09 09 09 09 09 2f 2f |.....{..|......//|
|00002890| 20 21 21 21 20 72 65 70 | 65 6c 3f 0d 09 09 09 09 | !!! rep|el?.....|
|000028a0| 09 09 09 2f 2f 20 48 61 | 6e 64 20 64 6f 65 73 6e |...// Ha|nd doesn|
|000028b0| 27 74 20 6e 65 65 64 20 | 61 20 73 69 6e 6b 2c 20 |'t need |a sink, |
|000028c0| 72 65 73 74 6f 72 65 20 | 67 6f 6f 64 50 74 20 74 |restore |goodPt t|
|000028d0| 6f 20 70 72 65 2d 44 65 | 74 65 6e 74 20 76 61 6c |o pre-De|tent val|
|000028e0| 75 65 0d 09 09 09 09 09 | 09 09 67 6f 6f 64 50 74 |ue......|..goodPt|
|000028f0| 20 3d 20 6c 69 6e 65 44 | 61 74 61 2e 66 69 72 73 | = lineD|ata.firs|
|00002900| 74 3b 0d 09 09 09 09 09 | 09 7d 0d 09 09 09 09 09 |t;......|.}......|
|00002910| 7d 0d 09 09 09 09 09 65 | 6c 73 65 20 2f 2f 20 64 |}......e|lse // d|
|00002920| 72 61 67 67 69 6e 67 20 | 61 72 72 6f 77 20 68 65 |ragging |arrow he|
|00002930| 61 64 0d 09 09 09 09 09 | 7b 0d 09 09 09 09 09 09 |ad......|{.......|
|00002940| 69 66 28 68 61 6e 64 2d | 3e 73 6f 75 72 63 65 2e |if(hand-|>source.|
|00002950| 74 69 6d 65 20 3d 3d 20 | 30 29 20 2f 2f 20 69 66 |time == |0) // if|
|00002960| 20 68 61 6e 64 20 6e 65 | 65 64 73 20 61 20 73 6f | hand ne|eds a so|
|00002970| 75 72 63 65 0d 09 09 09 | 09 09 09 7b 0d 09 09 09 |urce....|...{....|
|00002980| 09 09 09 09 6c 69 6e 65 | 44 61 74 61 2e 6c 61 73 |....line|Data.las|
|00002990| 74 20 3d 20 67 6f 6f 64 | 50 74 3b 20 2f 2f 20 4c |t = good|Pt; // L|
|000029a0| 65 67 61 6c 20 63 68 61 | 6e 67 65 2c 20 73 6f 20 |egal cha|nge, so |
|000029b0| 63 68 61 6e 67 65 20 69 | 74 0d 09 09 09 09 09 09 |change i|t.......|
|000029c0| 09 6c 69 6e 65 44 61 74 | 61 2e 6c 61 73 74 2e 78 |.lineDat|a.last.x|
|000029d0| 20 2d 3d 20 68 61 6e 64 | 52 61 64 69 75 73 3b 20 | -= hand|Radius; |
|000029e0| 20 2f 2f 20 67 65 74 20 | 69 74 20 6f 66 66 20 74 | // get |it off t|
|000029f0| 68 65 20 68 61 6e 64 0d | 09 09 09 09 09 09 09 6c |he hand.|.......l|
|00002a00| 65 67 61 6c 54 68 72 6f | 77 20 3d 20 74 72 75 65 |egalThro|w = true|
|00002a10| 3b 0d 09 09 09 09 09 09 | 7d 0d 09 09 09 09 09 09 |;.......|}.......|
|00002a20| 65 6c 73 65 0d 09 09 09 | 09 09 09 7b 0d 09 09 09 |else....|...{....|
|00002a30| 09 09 09 09 2f 2f 20 21 | 21 21 20 72 65 70 65 6c |....// !|!! repel|
|00002a40| 3f 0d 09 09 09 09 09 09 | 09 2f 2f 20 48 61 6e 64 |?.......|.// Hand|
|00002a50| 20 64 6f 65 73 6e 27 74 | 20 6e 65 65 64 20 61 20 | doesn't| need a |
|00002a60| 73 6f 75 72 63 65 2c 20 | 72 65 73 74 6f 72 65 20 |source, |restore |
|00002a70| 67 6f 6f 64 50 74 20 74 | 6f 20 70 72 65 2d 44 65 |goodPt t|o pre-De|
|00002a80| 74 65 6e 74 20 76 61 6c | 75 65 0d 09 09 09 09 09 |tent val|ue......|
|00002a90| 09 09 67 6f 6f 64 50 74 | 20 3d 20 6c 69 6e 65 44 |..goodPt| = lineD|
|00002aa0| 61 74 61 2e 6c 61 73 74 | 3b 0d 09 09 09 09 09 09 |ata.last|;.......|
|00002ab0| 7d 0d 09 09 09 09 09 7d | 0d 09 09 09 09 7d 0d 09 |}......}|.....}..|
|00002ac0| 09 09 7d 0d 09 09 20 20 | 09 0d 09 09 20 20 09 2f |..}... |.... ./|
|00002ad0| 2f 20 73 61 76 65 20 6c | 61 73 74 20 70 6f 69 6e |/ save l|ast poin|
|00002ae0| 74 0d 09 09 09 6c 61 73 | 74 50 74 20 3d 20 72 61 |t....las|tPt = ra|
|00002af0| 77 50 74 3b 0d 09 09 09 | 0d 09 09 09 2f 2f 20 4f |wPt;....|....// O|
|00002b00| 6e 6c 79 20 72 65 64 72 | 61 77 20 69 66 20 74 68 |nly redr|aw if th|
|00002b10| 65 20 6e 65 77 20 70 6f | 69 6e 74 20 69 73 20 64 |e new po|int is d|
|00002b20| 69 66 66 65 72 65 6e 74 | 20 74 68 61 6e 20 74 68 |ifferent| than th|
|00002b30| 65 20 6c 61 73 74 0d 09 | 09 09 69 66 28 67 6f 6f |e last..|..if(goo|
|00002b40| 64 50 74 2e 78 20 21 3d | 20 6c 61 73 74 47 6f 6f |dPt.x !=| lastGoo|
|00002b50| 64 50 74 2e 78 20 7c 7c | 20 67 6f 6f 64 50 74 2e |dPt.x ||| goodPt.|
|00002b60| 79 20 21 3d 20 6c 61 73 | 74 47 6f 6f 64 50 74 2e |y != las|tGoodPt.|
|00002b70| 79 29 0d 09 09 09 7b 0d | 09 09 09 09 2f 2f 20 45 |y)....{.|....// E|
|00002b80| 72 61 73 65 20 6f 6c 64 | 20 61 6e 64 20 64 72 61 |rase old| and dra|
|00002b90| 77 20 6e 65 77 0d 09 09 | 09 09 4d 6f 76 65 54 68 |w new...|..MoveTh|
|00002ba0| 72 6f 77 53 68 61 70 65 | 28 61 4a 75 67 67 6c 65 |rowShape|(aJuggle|
|00002bb0| 2c 20 73 68 61 70 65 49 | 6e 64 65 78 2c 20 26 6c |, shapeI|ndex, &l|
|00002bc0| 69 6e 65 44 61 74 61 29 | 3b 0d 09 09 09 09 0d 09 |ineData)|;.......|
|00002bd0| 09 09 09 2f 2f 20 53 61 | 76 65 20 74 68 69 73 20 |...// Sa|ve this |
|00002be0| 67 6f 6f 64 20 70 6f 69 | 6e 74 0d 09 09 09 09 6c |good poi|nt.....l|
|00002bf0| 61 73 74 47 6f 6f 64 50 | 74 20 3d 20 67 6f 6f 64 |astGoodP|t = good|
|00002c00| 50 74 3b 0d 09 09 09 7d | 0d 0d 09 09 7d 20 2f 2f |Pt;....}|....} //|
|00002c10| 20 69 66 20 6d 6f 75 73 | 65 20 6d 6f 76 65 64 0d | if mous|e moved.|
|00002c20| 09 7d 20 2f 2f 20 77 68 | 69 6c 65 20 73 74 69 6c |.} // wh|ile stil|
|00002c30| 6c 20 64 6f 77 6e 0d 09 | 0d 09 2f 2f 20 4d 6f 75 |l down..|..// Mou|
|00002c40| 73 65 20 62 75 74 74 6f | 6e 20 72 65 6c 65 61 73 |se butto|n releas|
|00002c50| 65 64 2e 20 49 66 20 61 | 20 6c 65 67 61 6c 20 74 |ed. If a| legal t|
|00002c60| 68 72 6f 77 2c 20 61 64 | 64 20 69 74 20 62 61 63 |hrow, ad|d it bac|
|00002c70| 6b 20 69 6e 20 74 6f 20 | 63 6f 6e 6e 65 63 74 69 |k in to |connecti|
|00002c80| 6f 6e 73 20 64 61 74 61 | 0d 09 69 66 28 6c 65 67 |ons data|..if(leg|
|00002c90| 61 6c 54 68 72 6f 77 29 | 0d 09 09 4c 69 6e 65 54 |alThrow)|...LineT|
|00002ca0| 6f 41 64 64 65 64 54 68 | 72 6f 77 28 61 4a 75 67 |oAddedTh|row(aJug|
|00002cb0| 67 6c 65 2c 20 26 6c 69 | 6e 65 44 61 74 61 29 3b |gle, &li|neData);|
|00002cc0| 0d 09 65 6c 73 65 20 2f | 2f 20 69 66 20 69 6c 6c |..else /|/ if ill|
|00002cd0| 65 67 61 6c 2c 20 65 72 | 61 73 65 20 61 6e 64 20 |egal, er|ase and |
|00002ce0| 72 65 6d 6f 76 65 20 66 | 72 6f 6d 20 74 68 65 20 |remove f|rom the |
|00002cf0| 70 69 63 74 75 72 65 73 | 0d 09 7b 0d 09 09 52 65 |pictures|..{...Re|
|00002d00| 6d 6f 76 65 54 68 72 6f | 77 53 68 61 70 65 28 61 |moveThro|wShape(a|
|00002d10| 4a 75 67 67 6c 65 2c 20 | 73 68 61 70 65 49 6e 64 |Juggle, |shapeInd|
|00002d20| 65 78 29 3b 0d 09 7d 0d | 7d 0d 0d 2f 2f 20 4c 69 |ex);..}.|}..// Li|
|00002d30| 6b 65 20 44 72 61 67 47 | 72 61 79 52 67 6e 2c 20 |ke DragG|rayRgn, |
|00002d40| 62 75 74 20 74 68 65 20 | 72 65 67 69 6f 6e 20 69 |but the |region i|
|00002d50| 73 20 63 6f 6e 73 74 72 | 61 69 6e 65 64 20 74 6f |s constr|ained to|
|00002d60| 20 67 72 69 64 20 70 6f | 69 6e 74 73 0d 50 6f 69 | grid po|ints.Poi|
|00002d70| 6e 74 20 44 72 61 67 47 | 72 61 79 52 67 6e 47 72 |nt DragG|rayRgnGr|
|00002d80| 69 64 64 65 64 28 52 67 | 6e 48 61 6e 64 6c 65 20 |idded(Rg|nHandle |
|00002d90| 74 68 65 52 67 6e 2c 20 | 50 6f 69 6e 74 20 73 74 |theRgn, |Point st|
|00002da0| 61 72 74 50 74 2c 20 52 | 65 63 74 20 2a 6c 69 6d |artPt, R|ect *lim|
|00002db0| 69 74 52 65 63 74 2c 0d | 09 09 09 09 09 09 52 65 |itRect,.|......Re|
|00002dc0| 63 74 20 2a 73 6c 6f 70 | 52 65 63 74 2c 20 73 68 |ct *slop|Rect, sh|
|00002dd0| 6f 72 74 20 61 78 69 73 | 2c 20 50 6f 69 6e 74 20 |ort axis|, Point |
|00002de0| 67 72 69 64 2c 20 50 6f | 69 6e 74 20 2a 69 6e 69 |grid, Po|int *ini|
|00002df0| 74 69 61 6c 4f 66 66 73 | 65 74 29 0d 7b 0d 09 50 |tialOffs|et).{..P|
|00002e00| 6f 69 6e 74 09 09 72 65 | 73 75 6c 74 2c 20 67 6f |oint..re|sult, go|
|00002e10| 6f 64 50 74 2c 20 72 61 | 77 4d 6f 75 73 65 2c 20 |odPt, ra|wMouse, |
|00002e20| 6c 61 73 74 47 6f 6f 64 | 50 74 2c 20 6c 61 73 74 |lastGood|Pt, last|
|00002e30| 52 61 77 4d 6f 75 73 65 | 2c 0d 09 09 09 09 67 72 |RawMouse|,.....gr|
|00002e40| 69 64 4f 66 66 73 65 74 | 2c 20 73 74 61 72 74 47 |idOffset|, startG|
|00002e50| 72 69 64 4f 66 66 73 65 | 74 3b 0d 09 42 6f 6f 6c |ridOffse|t;..Bool|
|00002e60| 65 61 6e 20 09 6f 75 74 | 73 69 64 65 53 6c 6f 70 |ean .out|sideSlop|
|00002e70| 3b 0d 09 50 65 6e 53 74 | 61 74 65 20 09 73 61 76 |;..PenSt|ate .sav|
|00002e80| 65 64 50 65 6e 3b 0d 09 | 0d 09 2f 2f 20 49 6e 69 |edPen;..|..// Ini|
|00002e90| 74 69 61 6c 69 7a 65 20 | 76 61 72 69 61 62 6c 65 |tialize |variable|
|00002ea0| 73 0d 09 69 66 28 69 6e | 69 74 69 61 6c 4f 66 66 |s..if(in|itialOff|
|00002eb0| 73 65 74 20 21 3d 20 6e | 69 6c 29 0d 09 09 41 64 |set != n|il)...Ad|
|00002ec0| 64 50 74 28 2a 69 6e 69 | 74 69 61 6c 4f 66 66 73 |dPt(*ini|tialOffs|
|00002ed0| 65 74 2c 20 26 73 74 61 | 72 74 50 74 29 3b 0d 09 |et, &sta|rtPt);..|
|00002ee0| 09 0d 09 67 6f 6f 64 50 | 74 20 3d 20 6c 61 73 74 |...goodP|t = last|
|00002ef0| 47 6f 6f 64 50 74 20 3d | 20 72 61 77 4d 6f 75 73 |GoodPt =| rawMous|
|00002f00| 65 20 3d 20 6c 61 73 74 | 52 61 77 4d 6f 75 73 65 |e = last|RawMouse|
|00002f10| 20 3d 20 73 74 61 72 74 | 50 74 3b 20 2f 2f 20 41 | = start|Pt; // A|
|00002f20| 6c 6c 20 74 68 65 20 73 | 61 6d 65 20 74 6f 20 73 |ll the s|ame to s|
|00002f30| 74 61 72 74 0d 09 72 65 | 73 75 6c 74 2e 68 20 3d |tart..re|sult.h =|
|00002f40| 20 72 65 73 75 6c 74 2e | 76 20 3d 20 30 3b 0d 09 | result.|v = 0;..|
|00002f50| 6f 75 74 73 69 64 65 53 | 6c 6f 70 20 3d 20 66 61 |outsideS|lop = fa|
|00002f60| 6c 73 65 3b 0d 09 0d 09 | 2f 2f 20 53 61 76 65 20 |lse;....|// Save |
|00002f70| 74 68 65 20 70 65 6e 20 | 73 74 61 74 65 2c 20 73 |the pen |state, s|
|00002f80| 65 74 20 6d 6f 64 65 20 | 74 6f 20 78 6f 72 0d 09 |et mode |to xor..|
|00002f90| 47 65 74 50 65 6e 53 74 | 61 74 65 28 26 73 61 76 |GetPenSt|ate(&sav|
|00002fa0| 65 64 50 65 6e 29 3b 0d | 09 50 65 6e 4e 6f 72 6d |edPen);.|.PenNorm|
|00002fb0| 61 6c 28 29 3b 0d 09 50 | 65 6e 4d 6f 64 65 28 73 |al();..P|enMode(s|
|00002fc0| 72 63 58 6f 72 29 3b 0d | 09 50 65 6e 50 61 74 28 |rcXor);.|.PenPat(|
|00002fd0| 26 71 64 2e 67 72 61 79 | 29 3b 0d 09 0d 09 2f 2f |&qd.gray|);....//|
|00002fe0| 20 44 72 61 77 20 74 68 | 65 20 72 67 6e 20 74 6f | Draw th|e rgn to|
|00002ff0| 20 73 74 61 72 74 0d 09 | 46 72 61 6d 65 52 67 6e | start..|FrameRgn|
|00003000| 28 74 68 65 52 67 6e 29 | 3b 0d 09 0d 09 2f 2f 20 |(theRgn)|;....// |
|00003010| 57 65 20 61 72 65 20 67 | 72 69 64 64 69 6e 67 20 |We are g|ridding |
|00003020| 74 68 65 20 72 67 6e 2c | 20 6e 6f 74 20 74 68 65 |the rgn,| not the|
|00003030| 20 70 6f 69 6e 74 20 69 | 74 73 65 6c 66 2c 20 73 | point i|tself, s|
|00003040| 6f 20 77 65 20 6e 65 65 | 64 20 74 6f 20 72 65 6d |o we nee|d to rem|
|00003050| 65 6d 62 65 72 0d 09 2f | 2f 20 74 68 65 20 61 6d |ember../|/ the am|
|00003060| 6f 75 6e 74 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |ount the| origina|
|00003070| 6c 20 70 6f 69 6e 74 20 | 77 61 73 20 6f 66 66 20 |l point |was off |
|00003080| 74 68 65 20 67 72 69 64 | 2e 0d 09 73 74 61 72 74 |the grid|...start|
|00003090| 47 72 69 64 4f 66 66 73 | 65 74 20 3d 20 73 74 61 |GridOffs|et = sta|
|000030a0| 72 74 50 74 3b 0d 09 47 | 65 74 53 68 6f 72 74 47 |rtPt;..G|etShortG|
|000030b0| 72 69 64 4f 66 66 73 65 | 74 28 26 73 74 61 72 74 |ridOffse|t(&start|
|000030c0| 47 72 69 64 4f 66 66 73 | 65 74 2c 20 67 72 69 64 |GridOffs|et, grid|
|000030d0| 29 3b 0d 0d 09 2f 2f 20 | 54 72 61 63 6b 20 74 68 |);...// |Track th|
|000030e0| 65 20 6d 6f 75 73 65 0d | 09 77 68 69 6c 65 28 53 |e mouse.|.while(S|
|000030f0| 74 69 6c 6c 44 6f 77 6e | 28 29 29 0d 09 7b 0d 09 |tillDown|())..{..|
|00003100| 09 2f 2f 20 47 65 74 20 | 74 68 65 20 63 75 72 72 |.// Get |the curr|
|00003110| 65 6e 74 20 6d 6f 75 73 | 65 20 70 6f 69 6e 74 2e |ent mous|e point.|
|00003120| 0d 09 09 47 65 74 4d 6f | 75 73 65 28 26 72 61 77 |...GetMo|use(&raw|
|00003130| 4d 6f 75 73 65 29 3b 0d | 09 09 0d 09 09 69 66 28 |Mouse);.|.....if(|
|00003140| 69 6e 69 74 69 61 6c 4f | 66 66 73 65 74 20 21 3d |initialO|ffset !=|
|00003150| 20 6e 69 6c 29 0d 09 09 | 09 41 64 64 50 74 28 2a | nil)...|.AddPt(*|
|00003160| 69 6e 69 74 69 61 6c 4f | 66 66 73 65 74 2c 20 26 |initialO|ffset, &|
|00003170| 72 61 77 4d 6f 75 73 65 | 29 3b 0d 09 09 0d 09 09 |rawMouse|);......|
|00003180| 2f 2f 20 49 66 20 74 68 | 65 20 6d 6f 75 73 65 20 |// If th|e mouse |
|00003190| 6d 6f 76 65 64 2c 20 64 | 6f 20 73 74 75 66 66 20 |moved, d|o stuff |
|000031a0| 2e 20 2e 20 2e 0d 09 09 | 69 66 28 72 61 77 4d 6f |. . ....|if(rawMo|
|000031b0| 75 73 65 2e 68 20 21 3d | 20 6c 61 73 74 52 61 77 |use.h !=| lastRaw|
|000031c0| 4d 6f 75 73 65 2e 68 20 | 7c 7c 20 72 61 77 4d 6f |Mouse.h ||| rawMo|
|000031d0| 75 73 65 2e 76 20 21 3d | 20 6c 61 73 74 52 61 77 |use.v !=| lastRaw|
|000031e0| 4d 6f 75 73 65 2e 76 29 | 0d 09 09 7b 0d 09 09 09 |Mouse.v)|...{....|
|000031f0| 2f 2f 20 69 66 20 69 74 | 27 73 20 69 6e 73 69 64 |// if it|'s insid|
|00003200| 65 20 74 68 65 20 73 6c | 6f 70 52 65 63 74 2e 2e |e the sl|opRect..|
|00003210| 2e 0d 09 09 09 69 66 28 | 50 74 49 6e 52 65 63 74 |.....if(|PtInRect|
|00003220| 28 72 61 77 4d 6f 75 73 | 65 2c 20 73 6c 6f 70 52 |(rawMous|e, slopR|
|00003230| 65 63 74 29 29 0d 09 09 | 09 7b 0d 09 09 09 09 2f |ect))...|.{...../|
|00003240| 2f 20 69 66 20 69 74 27 | 73 20 62 65 65 6e 20 6f |/ if it'|s been o|
|00003250| 75 74 73 69 64 65 20 74 | 68 65 20 73 6c 6f 70 52 |utside t|he slopR|
|00003260| 65 63 74 20 62 75 74 20 | 69 73 20 62 61 63 6b 20 |ect but |is back |
|00003270| 69 6e 73 69 64 65 c9 0d | 09 09 09 09 69 66 28 6f |inside..|....if(o|
|00003280| 75 74 73 69 64 65 53 6c | 6f 70 29 0d 09 09 09 09 |utsideSl|op).....|
|00003290| 7b 0d 09 09 09 09 09 2f | 2f 20 c9 72 65 64 72 61 |{....../|/ .redra|
|000032a0| 77 20 69 74 2c 20 61 6e | 64 20 66 6f 72 67 65 74 |w it, an|d forget|
|000032b0| 20 69 74 20 77 61 73 20 | 6f 75 74 73 69 64 65 0d | it was |outside.|
|000032c0| 09 09 09 09 09 46 72 61 | 6d 65 52 67 6e 28 74 68 |.....Fra|meRgn(th|
|000032d0| 65 52 67 6e 29 3b 0d 09 | 09 09 09 09 6f 75 74 73 |eRgn);..|....outs|
|000032e0| 69 64 65 53 6c 6f 70 20 | 3d 20 66 61 6c 73 65 3b |ideSlop |= false;|
|000032f0| 0d 09 09 09 09 7d 0d 09 | 09 09 09 0d 09 09 09 09 |.....}..|........|
|00003300| 2f 2f 20 57 65 27 6c 6c | 20 63 61 6c 63 75 6c 61 |// We'll| calcula|
|00003310| 74 65 20 61 20 22 67 6f | 6f 64 22 20 28 6c 65 67 |te a "go|od" (leg|
|00003320| 61 6c 29 20 70 6f 69 6e | 74 20 66 72 6f 6d 20 74 |al) poin|t from t|
|00003330| 68 65 20 72 61 77 20 6d | 6f 75 73 65 0d 09 09 09 |he raw m|ouse....|
|00003340| 09 67 6f 6f 64 50 74 20 | 3d 20 72 61 77 4d 6f 75 |.goodPt |= rawMou|
|00003350| 73 65 3b 0d 09 09 09 09 | 0d 09 09 09 09 2f 2f 20 |se;.....|.....// |
|00003360| 69 66 20 69 74 27 73 20 | 6f 75 74 73 69 64 65 20 |if it's |outside |
|00003370| 74 68 65 20 6c 69 6d 69 | 74 52 65 63 74 20 62 75 |the limi|tRect bu|
|00003380| 74 20 69 6e 73 69 64 65 | 20 74 68 65 20 73 6c 6f |t inside| the slo|
|00003390| 70 52 65 63 74 2e 2e 2e | 0d 09 09 09 09 69 66 28 |pRect...|.....if(|
|000033a0| 21 50 74 49 6e 52 65 63 | 74 28 67 6f 6f 64 50 74 |!PtInRec|t(goodPt|
|000033b0| 2c 20 6c 69 6d 69 74 52 | 65 63 74 29 29 0d 09 09 |, limitR|ect))...|
|000033c0| 09 09 7b 0d 09 09 09 09 | 09 6c 6f 6e 67 09 74 65 |..{.....|.long.te|
|000033d0| 6d 70 3b 0d 09 09 09 09 | 09 0d 09 09 09 09 09 2f |mp;.....|......./|
|000033e0| 2f 20 2e 2e 2e 70 69 6e | 20 74 68 65 20 70 6f 69 |/ ...pin| the poi|
|000033f0| 6e 74 20 74 6f 20 74 68 | 65 20 6c 69 6d 69 74 52 |nt to th|e limitR|
|00003400| 65 63 74 0d 09 09 09 09 | 09 74 65 6d 70 20 3d 20 |ect.....|.temp = |
|00003410| 50 69 6e 52 65 63 74 28 | 6c 69 6d 69 74 52 65 63 |PinRect(|limitRec|
|00003420| 74 2c 20 67 6f 6f 64 50 | 74 29 3b 0d 09 09 09 09 |t, goodP|t);.....|
|00003430| 09 67 6f 6f 64 50 74 20 | 3d 20 2a 28 50 6f 69 6e |.goodPt |= *(Poin|
|00003440| 74 20 2a 29 28 26 74 65 | 6d 70 29 3b 0d 09 09 09 |t *)(&te|mp);....|
|00003450| 09 7d 0d 0d 09 09 09 09 | 2f 2f 20 43 6f 6e 73 74 |.}......|// Const|
|00003460| 72 61 69 6e 20 74 68 65 | 20 70 6f 69 6e 74 20 74 |rain the| point t|
|00003470| 6f 20 74 68 65 20 67 72 | 69 64 2c 20 74 68 65 6e |o the gr|id, then|
|00003480| 20 61 64 64 20 62 61 63 | 6b 20 74 68 65 20 6f 72 | add bac|k the or|
|00003490| 69 67 69 6e 61 6c 20 6f | 66 66 73 65 74 2c 0d 09 |iginal o|ffset,..|
|000034a0| 09 09 09 2f 2f 20 73 6f | 20 77 65 20 6b 65 65 70 |...// so| we keep|
|000034b0| 20 74 68 65 20 73 61 6d | 65 20 6f 66 66 73 65 74 | the sam|e offset|
|000034c0| 20 66 72 6f 6d 20 74 68 | 65 20 67 72 69 64 20 70 | from th|e grid p|
|000034d0| 6f 69 6e 74 73 0d 09 09 | 09 09 67 72 69 64 4f 66 |oints...|..gridOf|
|000034e0| 66 73 65 74 20 3d 20 67 | 6f 6f 64 50 74 3b 0d 09 |fset = g|oodPt;..|
|000034f0| 09 09 09 47 65 74 53 68 | 6f 72 74 47 72 69 64 4f |...GetSh|ortGridO|
|00003500| 66 66 73 65 74 28 26 67 | 72 69 64 4f 66 66 73 65 |ffset(&g|ridOffse|
|00003510| 74 2c 20 67 72 69 64 29 | 3b 0d 09 09 09 09 67 6f |t, grid)|;.....go|
|00003520| 6f 64 50 74 2e 68 20 3d | 20 67 6f 6f 64 50 74 2e |odPt.h =| goodPt.|
|00003530| 68 20 2d 20 67 72 69 64 | 4f 66 66 73 65 74 2e 68 |h - grid|Offset.h|
|00003540| 20 2b 20 73 74 61 72 74 | 47 72 69 64 4f 66 66 73 | + start|GridOffs|
|00003550| 65 74 2e 68 3b 0d 09 09 | 09 09 67 6f 6f 64 50 74 |et.h;...|..goodPt|
|00003560| 2e 76 20 3d 20 67 6f 6f | 64 50 74 2e 76 20 2d 20 |.v = goo|dPt.v - |
|00003570| 67 72 69 64 4f 66 66 73 | 65 74 2e 76 20 2b 20 73 |gridOffs|et.v + s|
|00003580| 74 61 72 74 47 72 69 64 | 4f 66 66 73 65 74 2e 76 |tartGrid|Offset.v|
|00003590| 3b 0d 09 09 09 09 0d 09 | 09 09 09 2f 2f 20 69 66 |;.......|...// if|
|000035a0| 20 69 74 27 73 20 61 78 | 69 73 20 63 6f 6e 73 74 | it's ax|is const|
|000035b0| 72 61 69 6e 65 64 2c 20 | 63 6f 6e 73 74 72 61 69 |rained, |constrai|
|000035c0| 6e 20 69 74 0d 09 09 09 | 09 69 66 28 61 78 69 73 |n it....|.if(axis|
|000035d0| 20 21 3d 20 6e 6f 43 6f | 6e 73 74 72 61 69 6e 74 | != noCo|nstraint|
|000035e0| 29 0d 09 09 09 09 7b 0d | 09 09 09 09 09 69 66 28 |).....{.|.....if(|
|000035f0| 61 78 69 73 20 3d 3d 20 | 68 41 78 69 73 4f 6e 6c |axis == |hAxisOnl|
|00003600| 79 29 0d 09 09 09 09 09 | 09 67 6f 6f 64 50 74 2e |y)......|.goodPt.|
|00003610| 76 20 3d 20 6c 61 73 74 | 47 6f 6f 64 50 74 2e 76 |v = last|GoodPt.v|
|00003620| 3b 20 2f 2f 20 6b 65 65 | 70 20 74 68 65 20 76 65 |; // kee|p the ve|
|00003630| 72 74 69 63 61 6c 20 74 | 68 65 20 73 61 6d 65 0d |rtical t|he same.|
|00003640| 09 09 09 09 09 65 6c 73 | 65 20 2f 2f 20 61 73 73 |.....els|e // ass|
|00003650| 75 6d 65 20 76 41 78 69 | 73 4f 6e 6c 79 0d 09 09 |ume vAxi|sOnly...|
|00003660| 09 09 09 09 67 6f 6f 64 | 50 74 2e 68 20 3d 20 6c |....good|Pt.h = l|
|00003670| 61 73 74 47 6f 6f 64 50 | 74 2e 68 3b 20 2f 2f 20 |astGoodP|t.h; // |
|00003680| 6b 65 65 70 20 74 68 65 | 20 68 6f 72 69 7a 6f 6e |keep the| horizon|
|00003690| 74 61 6c 20 74 68 65 20 | 73 61 6d 65 0d 09 09 09 |tal the |same....|
|000036a0| 09 7d 0d 09 09 09 09 0d | 09 09 09 09 2f 2f 20 4f |.}......|....// O|
|000036b0| 4b 2c 20 77 65 20 68 61 | 76 65 20 61 20 67 6f 6f |K, we ha|ve a goo|
|000036c0| 64 20 70 6f 69 6e 74 2e | 20 69 66 20 69 74 27 73 |d point.| if it's|
|000036d0| 20 64 69 66 66 65 72 65 | 6e 74 20 74 68 61 6e 20 | differe|nt than |
|000036e0| 74 68 65 20 6c 61 73 74 | 2c 0d 09 09 09 09 2f 2f |the last|,.....//|
|000036f0| 20 6d 6f 76 65 20 74 68 | 65 20 72 67 6e 0d 09 09 | move th|e rgn...|
|00003700| 09 09 69 66 28 67 6f 6f | 64 50 74 2e 68 20 21 3d |..if(goo|dPt.h !=|
|00003710| 20 6c 61 73 74 47 6f 6f | 64 50 74 2e 68 20 7c 7c | lastGoo|dPt.h |||
|00003720| 20 67 6f 6f 64 50 74 2e | 76 20 21 3d 20 6c 61 73 | goodPt.|v != las|
|00003730| 74 47 6f 6f 64 50 74 2e | 76 29 0d 09 09 09 09 7b |tGoodPt.|v).....{|
|00003740| 0d 09 09 09 09 09 2f 2f | 20 45 72 61 73 65 20 69 |......//| Erase i|
|00003750| 74 2c 20 4d 6f 76 65 20 | 69 74 2c 20 72 65 64 72 |t, Move |it, redr|
|00003760| 61 77 20 69 74 0d 09 09 | 09 09 09 46 72 61 6d 65 |aw it...|...Frame|
|00003770| 52 67 6e 28 74 68 65 52 | 67 6e 29 3b 0d 09 09 09 |Rgn(theR|gn);....|
|00003780| 09 09 4f 66 66 73 65 74 | 52 67 6e 28 74 68 65 52 |..Offset|Rgn(theR|
|00003790| 67 6e 2c 20 67 6f 6f 64 | 50 74 2e 68 20 2d 20 6c |gn, good|Pt.h - l|
|000037a0| 61 73 74 47 6f 6f 64 50 | 74 2e 68 2c 20 67 6f 6f |astGoodP|t.h, goo|
|000037b0| 64 50 74 2e 76 20 2d 20 | 6c 61 73 74 47 6f 6f 64 |dPt.v - |lastGood|
|000037c0| 50 74 2e 76 29 3b 0d 09 | 09 09 09 09 46 72 61 6d |Pt.v);..|....Fram|
|000037d0| 65 52 67 6e 28 74 68 65 | 52 67 6e 29 3b 0d 09 09 |eRgn(the|Rgn);...|
|000037e0| 09 09 7d 0d 09 09 09 09 | 2f 2f 20 72 65 6d 65 6d |..}.....|// remem|
|000037f0| 62 65 72 20 74 68 65 20 | 67 6f 6f 64 20 70 6f 69 |ber the |good poi|
|00003800| 6e 74 0d 09 09 09 09 6c | 61 73 74 47 6f 6f 64 50 |nt.....l|astGoodP|
|00003810| 74 20 3d 20 67 6f 6f 64 | 50 74 3b 0d 09 09 09 7d |t = good|Pt;....}|
|00003820| 0d 09 09 09 65 6c 73 65 | 20 2f 2f 20 69 74 27 73 |....else| // it's|
|00003830| 20 6f 75 74 73 69 64 65 | 20 74 68 65 20 73 6c 6f | outside| the slo|
|00003840| 70 52 65 63 74 0d 09 09 | 09 7b 0d 09 09 09 09 2f |pRect...|.{...../|
|00003850| 2f 20 69 66 20 69 74 20 | 6a 75 73 74 20 77 65 6e |/ if it |just wen|
|00003860| 74 20 6f 75 74 73 69 64 | 65 2e 2e 2e 0d 09 09 09 |t outsid|e.......|
|00003870| 09 69 66 28 21 6f 75 74 | 73 69 64 65 53 6c 6f 70 |.if(!out|sideSlop|
|00003880| 29 0d 09 09 09 09 7b 0d | 09 09 09 09 09 2f 2f 20 |).....{.|.....// |
|00003890| 2e 2e 2e 65 72 61 73 65 | 20 74 68 65 20 72 67 6e |...erase| the rgn|
|000038a0| 2c 20 61 6e 64 20 72 65 | 6d 65 6d 62 65 72 20 74 |, and re|member t|
|000038b0| 68 65 20 70 6f 69 6e 74 | 20 69 73 20 6f 75 74 73 |he point| is outs|
|000038c0| 69 64 65 0d 09 09 09 09 | 09 46 72 61 6d 65 52 67 |ide.....|.FrameRg|
|000038d0| 6e 28 74 68 65 52 67 6e | 29 3b 0d 09 09 09 09 09 |n(theRgn|);......|
|000038e0| 6f 75 74 73 69 64 65 53 | 6c 6f 70 20 3d 20 74 72 |outsideS|lop = tr|
|000038f0| 75 65 3b 0d 09 09 09 09 | 7d 0d 09 09 09 7d 0d 09 |ue;.....|}....}..|
|00003900| 09 09 2f 2f 20 72 65 6d | 65 6d 62 65 72 20 74 68 |..// rem|ember th|
|00003910| 65 20 6d 6f 75 73 65 20 | 70 6f 73 69 74 69 6f 6e |e mouse |position|
|00003920| 0d 09 09 09 6c 61 73 74 | 52 61 77 4d 6f 75 73 65 |....last|RawMouse|
|00003930| 20 3d 20 72 61 77 4d 6f | 75 73 65 3b 0d 09 09 7d | = rawMo|use;...}|
|00003940| 0d 09 7d 0d 09 0d 09 2f | 2f 20 49 66 20 74 68 65 |..}..../|/ If the|
|00003950| 20 66 69 6e 61 6c 20 70 | 6f 69 6e 74 20 69 73 20 | final p|oint is |
|00003960| 73 74 69 6c 6c 20 6f 75 | 74 73 69 64 65 20 74 68 |still ou|tside th|
|00003970| 65 20 73 6c 6f 70 52 65 | 63 74 2c 20 72 65 74 75 |e slopRe|ct, retu|
|00003980| 72 6e 20 22 6e 6f 74 68 | 69 6e 67 22 0d 09 69 66 |rn "noth|ing"..if|
|00003990| 28 6f 75 74 73 69 64 65 | 53 6c 6f 70 29 0d 09 09 |(outside|Slop)...|
|000039a0| 72 65 73 75 6c 74 2e 68 | 20 3d 20 72 65 73 75 6c |result.h| = resul|
|000039b0| 74 2e 76 20 3d 20 30 78 | 38 30 30 30 3b 0d 09 2f |t.v = 0x|8000;../|
|000039c0| 2f 20 4f 74 68 65 72 77 | 69 73 65 20 75 73 65 20 |/ Otherw|ise use |
|000039d0| 74 68 65 20 6f 66 66 73 | 65 74 20 66 72 6f 6d 20 |the offs|et from |
|000039e0| 74 68 65 20 73 74 61 72 | 74 20 74 6f 20 74 68 65 |the star|t to the|
|000039f0| 20 65 78 69 73 74 69 6e | 67 20 67 6f 6f 64 20 70 | existin|g good p|
|00003a00| 6f 69 6e 74 2c 0d 09 2f | 2f 20 61 6e 64 20 64 6f |oint,../|/ and do|
|00003a10| 6e 27 74 20 66 6f 72 67 | 65 74 20 74 6f 20 65 72 |n't forg|et to er|
|00003a20| 61 73 65 20 74 68 65 20 | 52 67 6e 20 66 6f 72 20 |ase the |Rgn for |
|00003a30| 74 68 65 20 6c 61 73 74 | 20 74 69 6d 65 0d 09 65 |the last| time..e|
|00003a40| 6c 73 65 0d 09 7b 0d 09 | 09 72 65 73 75 6c 74 2e |lse..{..|.result.|
|00003a50| 68 20 3d 20 6c 61 73 74 | 47 6f 6f 64 50 74 2e 68 |h = last|GoodPt.h|
|00003a60| 20 2d 20 73 74 61 72 74 | 50 74 2e 68 3b 0d 09 09 | - start|Pt.h;...|
|00003a70| 72 65 73 75 6c 74 2e 76 | 20 3d 20 6c 61 73 74 47 |result.v| = lastG|
|00003a80| 6f 6f 64 50 74 2e 76 20 | 2d 20 73 74 61 72 74 50 |oodPt.v |- startP|
|00003a90| 74 2e 76 3b 0d 09 09 46 | 72 61 6d 65 52 67 6e 28 |t.v;...F|rameRgn(|
|00003aa0| 74 68 65 52 67 6e 29 3b | 0d 09 7d 0d 0d 09 2f 2f |theRgn);|..}...//|
|00003ab0| 20 52 65 73 74 6f 72 65 | 20 70 65 6e 0d 09 53 65 | Restore| pen..Se|
|00003ac0| 74 50 65 6e 53 74 61 74 | 65 28 26 73 61 76 65 64 |tPenStat|e(&saved|
|00003ad0| 50 65 6e 29 3b 0d 09 0d | 09 72 65 74 75 72 6e 20 |Pen);...|.return |
|00003ae0| 72 65 73 75 6c 74 3b 0d | 7d 0d 0d 0d 76 6f 69 64 |result;.|}...void|
|00003af0| 20 4b 65 65 70 50 74 49 | 6e 42 6f 75 6e 64 73 28 | KeepPtI|nBounds(|
|00003b00| 4a 75 67 67 6c 65 48 61 | 6e 64 6c 65 20 61 4a 75 |JuggleHa|ndle aJu|
|00003b10| 67 67 6c 65 2c 20 67 78 | 50 6f 69 6e 74 20 2a 70 |ggle, gx|Point *p|
|00003b20| 6f 69 6e 74 29 0d 7b 0d | 09 67 78 50 6f 69 6e 74 |oint).{.|.gxPoint|
|00003b30| 09 67 72 69 64 20 3d 20 | 28 2a 61 4a 75 67 67 6c |.grid = |(*aJuggl|
|00003b40| 65 29 2d 3e 67 72 69 64 | 50 74 3b 0d 09 0d 09 2f |e)->grid|Pt;..../|
|00003b50| 2f 20 4b 65 65 70 20 69 | 74 20 66 72 6f 6d 20 66 |/ Keep i|t from f|
|00003b60| 61 6c 6c 69 6e 67 20 6f | 66 66 20 74 68 65 20 6c |alling o|ff the l|
|00003b70| 65 66 74 20 65 64 67 65 | 0d 09 69 66 28 70 6f 69 |eft edge|..if(poi|
|00003b80| 6e 74 2d 3e 78 20 3c 20 | 30 29 0d 09 09 70 6f 69 |nt->x < |0)...poi|
|00003b90| 6e 74 2d 3e 78 20 3d 20 | 30 3b 0d 09 0d 09 2f 2f |nt->x = |0;....//|
|00003ba0| 20 6f 72 20 74 68 65 20 | 72 69 67 68 74 20 65 64 | or the |right ed|
|00003bb0| 67 65 20 28 54 57 49 43 | 45 20 74 68 65 20 6a 75 |ge (TWIC|E the ju|
|00003bc0| 67 67 6c 65 20 75 6e 69 | 74 29 0d 09 65 6c 73 65 |ggle uni|t)..else|
|00003bd0| 20 69 66 28 70 6f 69 6e | 74 2d 3e 78 20 3e 20 67 | if(poin|t->x > g|
|00003be0| 72 69 64 2e 78 20 2a 20 | 28 28 2a 61 4a 75 67 67 |rid.x * |((*aJugg|
|00003bf0| 6c 65 29 2d 3e 6e 75 6d | 43 6f 75 6e 74 73 20 2a |le)->num|Counts *|
|00003c00| 20 32 20 2d 20 31 29 29 | 0d 09 09 70 6f 69 6e 74 | 2 - 1))|...point|
|00003c10| 2d 3e 78 20 3d 20 67 72 | 69 64 2e 78 20 2a 20 28 |->x = gr|id.x * (|
|00003c20| 28 2a 61 4a 75 67 67 6c | 65 29 2d 3e 6e 75 6d 43 |(*aJuggl|e)->numC|
|00003c30| 6f 75 6e 74 73 20 2a 20 | 32 20 2d 20 31 29 3b 0d |ounts * |2 - 1);.|
|00003c40| 09 0d 09 2f 2f 20 61 6e | 64 20 6e 6f 74 20 6f 66 |...// an|d not of|
|00003c50| 66 20 74 68 65 20 62 6f | 74 74 6f 6d 20 6f 72 20 |f the bo|ttom or |
|00003c60| 74 6f 70 0d 09 69 66 28 | 70 6f 69 6e 74 2d 3e 79 |top..if(|point->y|
|00003c70| 20 3c 20 30 29 0d 09 09 | 70 6f 69 6e 74 2d 3e 79 | < 0)...|point->y|
|00003c80| 20 3d 20 30 3b 0d 09 65 | 6c 73 65 20 69 66 28 70 | = 0;..e|lse if(p|
|00003c90| 6f 69 6e 74 2d 3e 79 20 | 3e 20 67 72 69 64 2e 79 |oint->y |> grid.y|
|00003ca0| 20 2a 20 28 28 2a 61 4a | 75 67 67 6c 65 29 2d 3e | * ((*aJ|uggle)->|
|00003cb0| 6e 75 6d 4a 75 67 67 6c | 65 72 73 20 2d 20 31 29 |numJuggl|ers - 1)|
|00003cc0| 29 0d 09 09 70 6f 69 6e | 74 2d 3e 79 20 3d 20 67 |)...poin|t->y = g|
|00003cd0| 72 69 64 2e 79 20 2a 20 | 28 28 2a 61 4a 75 67 67 |rid.y * |((*aJugg|
|00003ce0| 6c 65 29 2d 3e 6e 75 6d | 4a 75 67 67 6c 65 72 73 |le)->num|Jugglers|
|00003cf0| 20 2d 20 31 29 3b 0d 7d | 0d 0d 2f 2f 2d 2d 2d 2d | - 1);.}|..//----|
|00003d00| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003d10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003d20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003d30| 0d 2f 2f 20 67 72 69 64 | 20 65 6e 66 6f 72 63 65 |.// grid| enforce|
|00003d40| 6d 65 6e 74 20 72 6f 75 | 74 69 6e 65 73 0d 0d 2f |ment rou|tines../|
|00003d50| 2f 20 54 68 69 73 20 72 | 6f 75 74 69 6e 65 20 72 |/ This r|outine r|
|00003d60| 65 74 75 72 6e 73 20 74 | 68 65 20 61 6d 6f 75 6e |eturns t|he amoun|
|00003d70| 74 20 74 68 65 20 67 69 | 76 65 6e 20 70 6f 69 6e |t the gi|ven poin|
|00003d80| 74 20 69 73 20 6f 66 66 | 20 74 68 65 0d 2f 2f 20 |t is off| the.// |
|00003d90| 67 69 76 65 6e 20 67 72 | 69 64 2e 0d 76 6f 69 64 |given gr|id..void|
|00003da0| 20 47 65 74 47 72 69 64 | 4f 66 66 73 65 74 28 67 | GetGrid|Offset(g|
|00003db0| 78 50 6f 69 6e 74 20 2a | 70 6f 69 6e 74 44 61 74 |xPoint *|pointDat|
|00003dc0| 61 2c 20 67 78 50 6f 69 | 6e 74 20 2a 67 72 69 64 |a, gxPoi|nt *grid|
|00003dd0| 29 0d 7b 0d 09 67 78 50 | 6f 69 6e 74 09 6c 6f 63 |).{..gxP|oint.loc|
|00003de0| 61 6c 50 74 20 3d 20 2a | 70 6f 69 6e 74 44 61 74 |alPt = *|pointDat|
|00003df0| 61 3b 0d 09 0d 09 2f 2f | 20 43 61 6c 63 75 6c 61 |a;....//| Calcula|
|00003e00| 74 65 20 74 68 65 20 61 | 6d 6f 75 6e 74 20 6f 66 |te the a|mount of|
|00003e10| 66 20 67 72 69 64 20 28 | 72 65 6d 61 69 6e 64 65 |f grid (|remainde|
|00003e20| 72 20 6f 66 20 64 69 76 | 69 64 69 6e 67 20 62 79 |r of div|iding by|
|00003e30| 20 74 68 65 20 67 72 69 | 64 29 0d 09 6c 6f 63 61 | the gri|d)..loca|
|00003e40| 6c 50 74 2e 78 20 25 3d | 20 67 72 69 64 2d 3e 78 |lPt.x %=| grid->x|
|00003e50| 3b 0d 09 6c 6f 63 61 6c | 50 74 2e 79 20 25 3d 20 |;..local|Pt.y %= |
|00003e60| 67 72 69 64 2d 3e 79 3b | 0d 09 0d 09 2f 2f 20 49 |grid->y;|....// I|
|00003e70| 66 20 74 68 65 20 61 6d | 6f 75 6e 74 20 6f 66 66 |f the am|ount off|
|00003e80| 20 67 72 69 64 20 69 73 | 20 67 72 65 61 74 65 72 | grid is| greater|
|00003e90| 20 74 68 61 6e 20 68 61 | 6c 66 20 74 68 65 20 67 | than ha|lf the g|
|00003ea0| 72 69 64 20 73 70 61 63 | 69 6e 67 2c 0d 09 2f 2f |rid spac|ing,..//|
|00003eb0| 20 28 6f 72 20 6c 65 73 | 73 20 74 68 61 6e 20 69 | (or les|s than i|
|00003ec0| 74 73 20 6e 65 67 61 74 | 69 76 65 29 20 74 68 65 |ts negat|ive) the|
|00003ed0| 6e 20 74 68 65 20 70 6f | 69 6e 74 20 69 73 20 0d |n the po|int is .|
|00003ee0| 09 2f 2f 20 22 62 65 66 | 6f 72 65 22 20 74 68 65 |.// "bef|ore" the|
|00003ef0| 20 6e 65 61 72 65 73 74 | 20 67 72 69 64 20 70 6f | nearest| grid po|
|00003f00| 69 6e 74 2e 20 4d 61 6b | 65 20 69 74 20 61 20 73 |int. Mak|e it a s|
|00003f10| 6d 61 6c 6c 20 6f 70 70 | 6f 73 69 74 65 20 73 69 |mall opp|osite si|
|00003f20| 67 6e 65 64 0d 09 2f 2f | 20 20 6f 66 66 73 65 74 |gned..//| offset|
|00003f30| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 61 20 6c 61 | instead| of a la|
|00003f40| 72 67 65 20 6f 6e 65 2c | 20 73 6f 20 77 65 20 63 |rge one,| so we c|
|00003f50| 61 6e 20 6a 75 73 74 20 | 73 75 62 74 72 61 63 74 |an just |subtract|
|00003f60| 20 69 74 20 66 72 6f 6d | 20 74 68 65 0d 09 2f 2f | it from| the..//|
|00003f70| 20 70 6f 69 6e 74 20 74 | 6f 20 67 72 69 64 20 69 | point t|o grid i|
|00003f80| 74 2e 0d 09 69 66 28 6c | 6f 63 61 6c 50 74 2e 78 |t...if(l|ocalPt.x|
|00003f90| 20 3c 20 30 29 0d 09 7b | 0d 09 09 69 66 28 6c 6f | < 0)..{|...if(lo|
|00003fa0| 63 61 6c 50 74 2e 78 20 | 3c 20 2d 28 67 72 69 64 |calPt.x |< -(grid|
|00003fb0| 2d 3e 78 20 2f 20 32 29 | 29 0d 09 09 09 6c 6f 63 |->x / 2)|)....loc|
|00003fc0| 61 6c 50 74 2e 78 20 3d | 20 67 72 69 64 2d 3e 78 |alPt.x =| grid->x|
|00003fd0| 20 2b 20 6c 6f 63 61 6c | 50 74 2e 78 3b 0d 09 7d | + local|Pt.x;..}|
|00003fe0| 0d 09 65 6c 73 65 0d 09 | 7b 0d 09 09 69 66 28 6c |..else..|{...if(l|
|00003ff0| 6f 63 61 6c 50 74 2e 78 | 20 3e 20 28 67 72 69 64 |ocalPt.x| > (grid|
|00004000| 2d 3e 78 20 2f 20 32 29 | 29 0d 09 09 09 6c 6f 63 |->x / 2)|)....loc|
|00004010| 61 6c 50 74 2e 78 20 3d | 20 6c 6f 63 61 6c 50 74 |alPt.x =| localPt|
|00004020| 2e 78 20 2d 20 67 72 69 | 64 2d 3e 78 3b 0d 09 7d |.x - gri|d->x;..}|
|00004030| 0d 09 69 66 28 6c 6f 63 | 61 6c 50 74 2e 79 20 3c |..if(loc|alPt.y <|
|00004040| 20 30 29 0d 09 7b 0d 09 | 09 69 66 28 6c 6f 63 61 | 0)..{..|.if(loca|
|00004050| 6c 50 74 2e 79 20 3c 20 | 2d 28 67 72 69 64 2d 3e |lPt.y < |-(grid->|
|00004060| 79 20 2f 20 32 29 29 0d | 09 09 09 6c 6f 63 61 6c |y / 2)).|...local|
|00004070| 50 74 2e 79 20 3d 20 67 | 72 69 64 2d 3e 79 20 2b |Pt.y = g|rid->y +|
|00004080| 20 6c 6f 63 61 6c 50 74 | 2e 79 3b 0d 09 7d 0d 09 | localPt|.y;..}..|
|00004090| 65 6c 73 65 0d 09 7b 0d | 09 09 69 66 28 6c 6f 63 |else..{.|..if(loc|
|000040a0| 61 6c 50 74 2e 79 20 3e | 20 28 67 72 69 64 2d 3e |alPt.y >| (grid->|
|000040b0| 79 20 2f 20 32 29 29 0d | 09 09 09 6c 6f 63 61 6c |y / 2)).|...local|
|000040c0| 50 74 2e 79 20 3d 20 6c | 6f 63 61 6c 50 74 2e 79 |Pt.y = l|ocalPt.y|
|000040d0| 20 2d 20 67 72 69 64 2d | 3e 79 3b 0d 09 7d 0d 09 | - grid-|>y;..}..|
|000040e0| 0d 09 2a 70 6f 69 6e 74 | 44 61 74 61 20 3d 20 6c |..*point|Data = l|
|000040f0| 6f 63 61 6c 50 74 3b 0d | 7d 0d 0d 2f 2f 20 54 68 |ocalPt;.|}..// Th|
|00004100| 69 73 20 72 6f 75 74 69 | 6e 65 20 72 65 74 75 72 |is routi|ne retur|
|00004110| 6e 73 20 74 68 65 20 61 | 6d 6f 75 6e 74 20 74 68 |ns the a|mount th|
|00004120| 65 20 67 69 76 65 6e 20 | 70 6f 69 6e 74 20 69 73 |e given |point is|
|00004130| 20 6f 66 66 20 74 68 65 | 0d 2f 2f 20 67 69 76 65 | off the|.// give|
|00004140| 6e 20 67 72 69 64 2e 20 | 28 69 6e 74 65 67 65 72 |n grid. |(integer|
|00004150| 20 63 6f 6f 72 64 73 20 | 76 65 72 73 69 6f 6e 29 | coords |version)|
|00004160| 0d 76 6f 69 64 20 47 65 | 74 53 68 6f 72 74 47 72 |.void Ge|tShortGr|
|00004170| 69 64 4f 66 66 73 65 74 | 28 50 6f 69 6e 74 20 2a |idOffset|(Point *|
|00004180| 70 6f 69 6e 74 44 61 74 | 61 2c 20 50 6f 69 6e 74 |pointDat|a, Point|
|00004190| 20 67 72 69 64 29 0d 7b | 0d 09 50 6f 69 6e 74 09 | grid).{|..Point.|
|000041a0| 6c 6f 63 61 6c 50 74 20 | 3d 20 2a 70 6f 69 6e 74 |localPt |= *point|
|000041b0| 44 61 74 61 3b 0d 09 0d | 09 2f 2f 20 43 61 6c 63 |Data;...|.// Calc|
|000041c0| 75 6c 61 74 65 20 74 68 | 65 20 61 6d 6f 75 6e 74 |ulate th|e amount|
|000041d0| 20 6f 66 66 20 67 72 69 | 64 20 28 72 65 6d 61 69 | off gri|d (remai|
|000041e0| 6e 64 65 72 20 6f 66 20 | 64 69 76 69 64 69 6e 67 |nder of |dividing|
|000041f0| 20 62 79 20 74 68 65 20 | 67 72 69 64 29 0d 09 6c | by the |grid)..l|
|00004200| 6f 63 61 6c 50 74 2e 68 | 20 25 3d 20 67 72 69 64 |ocalPt.h| %= grid|
|00004210| 2e 68 3b 0d 09 6c 6f 63 | 61 6c 50 74 2e 76 20 25 |.h;..loc|alPt.v %|
|00004220| 3d 20 67 72 69 64 2e 76 | 3b 0d 09 0d 09 2f 2f 20 |= grid.v|;....// |
|00004230| 49 66 20 74 68 65 20 61 | 6d 6f 75 6e 74 20 6f 66 |If the a|mount of|
|00004240| 66 20 67 72 69 64 20 69 | 73 20 67 72 65 61 74 65 |f grid i|s greate|
|00004250| 72 20 74 68 61 6e 20 68 | 61 6c 66 20 74 68 65 20 |r than h|alf the |
|00004260| 67 72 69 64 20 73 70 61 | 63 69 6e 67 2c 0d 09 2f |grid spa|cing,../|
|00004270| 2f 20 28 6f 72 20 6c 65 | 73 73 20 74 68 61 6e 20 |/ (or le|ss than |
|00004280| 69 74 73 20 6e 65 67 61 | 74 69 76 65 29 20 74 68 |its nega|tive) th|
|00004290| 65 6e 20 74 68 65 20 70 | 6f 69 6e 74 20 69 73 20 |en the p|oint is |
|000042a0| 0d 09 2f 2f 20 22 62 65 | 66 6f 72 65 22 20 74 68 |..// "be|fore" th|
|000042b0| 65 20 6e 65 61 72 65 73 | 74 20 67 72 69 64 20 70 |e neares|t grid p|
|000042c0| 6f 69 6e 74 2e 20 4d 61 | 6b 65 20 69 74 20 61 20 |oint. Ma|ke it a |
|000042d0| 73 6d 61 6c 6c 20 6f 70 | 70 6f 73 69 74 65 20 73 |small op|posite s|
|000042e0| 69 67 6e 65 64 0d 09 2f | 2f 20 20 6f 66 66 73 65 |igned../|/ offse|
|000042f0| 74 20 69 6e 73 74 65 61 | 64 20 6f 66 20 61 20 6c |t instea|d of a l|
|00004300| 61 72 67 65 20 6f 6e 65 | 2c 20 73 6f 20 77 65 20 |arge one|, so we |
|00004310| 63 61 6e 20 6a 75 73 74 | 20 73 75 62 74 72 61 63 |can just| subtrac|
|00004320| 74 20 69 74 20 66 72 6f | 6d 20 74 68 65 0d 09 2f |t it fro|m the../|
|00004330| 2f 20 70 6f 69 6e 74 20 | 74 6f 20 67 72 69 64 20 |/ point |to grid |
|00004340| 69 74 2e 0d 09 69 66 28 | 6c 6f 63 61 6c 50 74 2e |it...if(|localPt.|
|00004350| 68 20 3c 20 30 29 0d 09 | 7b 0d 09 09 69 66 28 6c |h < 0)..|{...if(l|
|00004360| 6f 63 61 6c 50 74 2e 68 | 20 3c 20 2d 28 67 72 69 |ocalPt.h| < -(gri|
|00004370| 64 2e 68 20 2f 20 32 29 | 29 0d 09 09 09 6c 6f 63 |d.h / 2)|)....loc|
|00004380| 61 6c 50 74 2e 68 20 3d | 20 67 72 69 64 2e 68 20 |alPt.h =| grid.h |
|00004390| 2b 20 6c 6f 63 61 6c 50 | 74 2e 68 3b 0d 09 7d 0d |+ localP|t.h;..}.|
|000043a0| 09 65 6c 73 65 0d 09 7b | 0d 09 09 69 66 28 6c 6f |.else..{|...if(lo|
|000043b0| 63 61 6c 50 74 2e 68 20 | 3e 20 28 67 72 69 64 2e |calPt.h |> (grid.|
|000043c0| 68 20 2f 20 32 29 29 0d | 09 09 09 6c 6f 63 61 6c |h / 2)).|...local|
|000043d0| 50 74 2e 68 20 3d 20 6c | 6f 63 61 6c 50 74 2e 68 |Pt.h = l|ocalPt.h|
|000043e0| 20 2d 20 67 72 69 64 2e | 68 3b 0d 09 7d 0d 09 69 | - grid.|h;..}..i|
|000043f0| 66 28 6c 6f 63 61 6c 50 | 74 2e 76 20 3c 20 30 29 |f(localP|t.v < 0)|
|00004400| 0d 09 7b 0d 09 09 69 66 | 28 6c 6f 63 61 6c 50 74 |..{...if|(localPt|
|00004410| 2e 76 20 3c 20 2d 28 67 | 72 69 64 2e 76 20 2f 20 |.v < -(g|rid.v / |
|00004420| 32 29 29 0d 09 09 09 6c | 6f 63 61 6c 50 74 2e 76 |2))....l|ocalPt.v|
|00004430| 20 3d 20 67 72 69 64 2e | 76 20 2b 20 6c 6f 63 61 | = grid.|v + loca|
|00004440| 6c 50 74 2e 76 3b 0d 09 | 7d 0d 09 65 6c 73 65 0d |lPt.v;..|}..else.|
|00004450| 09 7b 0d 09 09 69 66 28 | 6c 6f 63 61 6c 50 74 2e |.{...if(|localPt.|
|00004460| 76 20 3e 20 28 67 72 69 | 64 2e 76 20 2f 20 32 29 |v > (gri|d.v / 2)|
|00004470| 29 0d 09 09 09 6c 6f 63 | 61 6c 50 74 2e 76 20 3d |)....loc|alPt.v =|
|00004480| 20 6c 6f 63 61 6c 50 74 | 2e 76 20 2d 20 67 72 69 | localPt|.v - gri|
|00004490| 64 2e 76 3b 0d 09 7d 0d | 09 0d 09 2a 70 6f 69 6e |d.v;..}.|...*poin|
|000044a0| 74 44 61 74 61 20 3d 20 | 6c 6f 63 61 6c 50 74 3b |tData = |localPt;|
|000044b0| 0d 7d 0d 0d 2f 2f 20 54 | 68 69 73 20 72 6f 75 74 |.}..// T|his rout|
|000044c0| 69 6e 65 20 63 68 65 63 | 6b 73 20 74 68 65 20 67 |ine chec|ks the g|
|000044d0| 69 76 65 6e 20 70 6f 69 | 6e 74 20 74 6f 20 73 65 |iven poi|nt to se|
|000044e0| 65 20 69 66 20 69 74 27 | 73 0d 2f 2f 20 77 69 74 |e if it'|s.// wit|
|000044f0| 68 69 6e 20 64 65 74 65 | 6e 74 4c 69 6d 69 74 20 |hin dete|ntLimit |
|00004500| 6f 66 20 61 20 67 72 69 | 64 20 70 6f 69 6e 74 2e |of a gri|d point.|
|00004510| 20 49 66 20 69 74 20 69 | 73 2c 20 74 68 65 0d 2f | If it i|s, the./|
|00004520| 2f 20 70 6f 69 6e 74 20 | 69 73 20 73 65 74 20 74 |/ point |is set t|
|00004530| 6f 20 74 68 65 20 67 72 | 69 64 20 70 6f 69 6e 74 |o the gr|id point|
|00004540| 2c 20 61 6e 64 20 74 72 | 75 65 20 69 73 20 72 65 |, and tr|ue is re|
|00004550| 74 75 72 6e 65 64 2e 0d | 2f 2f 20 4f 74 68 65 72 |turned..|// Other|
|00004560| 77 69 73 65 20 69 74 27 | 73 20 75 6e 63 68 61 6e |wise it'|s unchan|
|00004570| 67 65 64 20 61 6e 64 20 | 66 61 6c 73 65 20 69 73 |ged and |false is|
|00004580| 20 72 65 74 75 72 6e 65 | 64 2e 0d 42 6f 6f 6c 65 | returne|d..Boole|
|00004590| 61 6e 20 44 65 74 65 6e | 74 28 67 78 50 6f 69 6e |an Deten|t(gxPoin|
|000045a0| 74 20 2a 70 6f 69 6e 74 | 44 61 74 61 2c 20 67 78 |t *point|Data, gx|
|000045b0| 50 6f 69 6e 74 20 2a 67 | 72 69 64 2c 20 46 69 78 |Point *g|rid, Fix|
|000045c0| 65 64 20 64 65 74 65 6e | 74 4c 69 6d 69 74 29 0d |ed deten|tLimit).|
|000045d0| 7b 0d 09 67 78 50 6f 69 | 6e 74 09 09 6c 6f 63 61 |{..gxPoi|nt..loca|
|000045e0| 6c 50 74 20 3d 20 2a 70 | 6f 69 6e 74 44 61 74 61 |lPt = *p|ointData|
|000045f0| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 72 65 73 75 |;..Boole|an..resu|
|00004600| 6c 74 3b 0d 09 0d 09 2f | 2f 20 43 61 6c 63 75 6c |lt;..../|/ Calcul|
|00004610| 61 74 65 20 74 68 65 20 | 61 6d 6f 75 6e 74 20 6f |ate the |amount o|
|00004620| 66 66 20 67 72 69 64 0d | 09 47 65 74 47 72 69 64 |ff grid.|.GetGrid|
|00004630| 4f 66 66 73 65 74 28 26 | 6c 6f 63 61 6c 50 74 2c |Offset(&|localPt,|
|00004640| 20 67 72 69 64 29 3b 0d | 09 0d 09 2f 2f 20 43 68 | grid);.|...// Ch|
|00004650| 65 63 6b 20 66 6f 72 20 | 61 20 74 6f 75 63 68 2e |eck for |a touch.|
|00004660| 20 49 66 20 73 6f 2c 20 | 67 72 69 64 20 74 68 65 | If so, |grid the|
|00004670| 20 70 6f 69 6e 74 20 61 | 6e 64 20 72 65 74 75 72 | point a|nd retur|
|00004680| 6e 20 74 72 75 65 2e 0d | 09 69 66 28 66 69 78 41 |n true..|.if(fixA|
|00004690| 62 73 28 6c 6f 63 61 6c | 50 74 2e 78 29 20 3c 20 |bs(local|Pt.x) < |
|000046a0| 64 65 74 65 6e 74 4c 69 | 6d 69 74 20 26 26 20 66 |detentLi|mit && f|
|000046b0| 69 78 41 62 73 28 6c 6f | 63 61 6c 50 74 2e 79 29 |ixAbs(lo|calPt.y)|
|000046c0| 20 3c 20 64 65 74 65 6e | 74 4c 69 6d 69 74 29 0d | < deten|tLimit).|
|000046d0| 09 7b 0d 09 09 70 6f 69 | 6e 74 44 61 74 61 2d 3e |.{...poi|ntData->|
|000046e0| 78 20 2d 3d 20 6c 6f 63 | 61 6c 50 74 2e 78 3b 0d |x -= loc|alPt.x;.|
|000046f0| 09 09 70 6f 69 6e 74 44 | 61 74 61 2d 3e 79 20 2d |..pointD|ata->y -|
|00004700| 3d 20 6c 6f 63 61 6c 50 | 74 2e 79 3b 0d 09 09 72 |= localP|t.y;...r|
|00004710| 65 73 75 6c 74 20 3d 20 | 74 72 75 65 3b 0d 09 7d |esult = |true;..}|
|00004720| 0d 09 65 6c 73 65 0d 09 | 09 72 65 73 75 6c 74 20 |..else..|.result |
|00004730| 3d 20 66 61 6c 73 65 3b | 0d 09 0d 09 72 65 74 75 |= false;|....retu|
|00004740| 72 6e 20 72 65 73 75 6c | 74 3b 0d 7d 0d 0d 2f 2f |rn resul|t;.}..//|
|00004750| 20 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 66 6f | This ro|utine fo|
|00004760| 72 63 65 73 20 74 68 65 | 20 67 69 76 65 6e 20 70 |rces the| given p|
|00004770| 6f 69 6e 74 20 74 6f 20 | 74 68 65 20 6e 65 61 72 |oint to |the near|
|00004780| 65 73 74 20 67 72 69 64 | 20 70 6f 73 69 74 69 6f |est grid| positio|
|00004790| 6e 2c 0d 2f 2f 20 74 68 | 65 6e 20 63 6f 6e 76 65 |n,.// th|en conve|
|000047a0| 72 74 73 20 69 74 20 74 | 6f 20 61 20 31 2d 62 61 |rts it t|o a 1-ba|
|000047b0| 73 65 64 20 67 72 69 64 | 20 6c 6f 63 61 74 69 6f |sed grid| locatio|
|000047c0| 6e 20 69 6e 73 74 65 61 | 64 20 6f 66 20 61 20 6c |n instea|d of a l|
|000047d0| 6f 63 61 74 69 6f 6e 20 | 69 6e 20 0d 2f 2f 20 74 |ocation |in .// t|
|000047e0| 68 65 20 76 69 65 77 20 | 70 6f 72 74 27 73 20 63 |he view |port's c|
|000047f0| 6f 6f 72 64 69 6e 61 74 | 65 73 2e 0d 76 6f 69 64 |oordinat|es..void|
|00004800| 20 53 65 74 47 72 69 64 | 50 6f 73 28 67 78 50 6f | SetGrid|Pos(gxPo|
|00004810| 69 6e 74 20 2a 70 6f 69 | 6e 74 44 61 74 61 2c 20 |int *poi|ntData, |
|00004820| 67 78 50 6f 69 6e 74 20 | 2a 67 72 69 64 29 0d 7b |gxPoint |*grid).{|
|00004830| 0d 09 67 78 50 6f 69 6e | 74 09 6c 6f 63 61 6c 50 |..gxPoin|t.localP|
|00004840| 74 20 3d 20 2a 70 6f 69 | 6e 74 44 61 74 61 3b 0d |t = *poi|ntData;.|
|00004850| 09 0d 09 2f 2f 20 43 61 | 6c 63 75 6c 61 74 65 20 |...// Ca|lculate |
|00004860| 74 68 65 20 61 6d 6f 75 | 6e 74 20 6f 66 66 20 67 |the amou|nt off g|
|00004870| 72 69 64 0d 09 47 65 74 | 47 72 69 64 4f 66 66 73 |rid..Get|GridOffs|
|00004880| 65 74 28 26 6c 6f 63 61 | 6c 50 74 2c 20 67 72 69 |et(&loca|lPt, gri|
|00004890| 64 29 3b 0d 09 0d 09 2f | 2f 20 46 6f 72 63 65 20 |d);..../|/ Force |
|000048a0| 70 6f 69 6e 74 20 74 6f | 20 6e 65 61 72 65 73 74 |point to| nearest|
|000048b0| 20 67 72 69 64 20 70 6f | 69 6e 74 0d 09 70 6f 69 | grid po|int..poi|
|000048c0| 6e 74 44 61 74 61 2d 3e | 78 20 2d 3d 20 6c 6f 63 |ntData->|x -= loc|
|000048d0| 61 6c 50 74 2e 78 3b 0d | 09 70 6f 69 6e 74 44 61 |alPt.x;.|.pointDa|
|000048e0| 74 61 2d 3e 79 20 2d 3d | 20 6c 6f 63 61 6c 50 74 |ta->y -=| localPt|
|000048f0| 2e 79 3b 0d 09 0d 09 2f | 2f 20 43 6f 6e 76 65 72 |.y;..../|/ Conver|
|00004900| 74 20 74 6f 20 61 20 31 | 2d 62 61 73 65 64 20 67 |t to a 1|-based g|
|00004910| 72 69 64 20 6c 6f 63 61 | 74 69 6f 6e 2c 20 66 69 |rid loca|tion, fi|
|00004920| 78 65 64 0d 09 70 6f 69 | 6e 74 44 61 74 61 2d 3e |xed..poi|ntData->|
|00004930| 78 20 2f 3d 20 67 72 69 | 64 2d 3e 78 3b 20 09 09 |x /= gri|d->x; ..|
|00004940| 09 2f 2f 20 69 6e 74 65 | 67 65 72 20 72 65 73 75 |.// inte|ger resu|
|00004950| 6c 74 0d 09 70 6f 69 6e | 74 44 61 74 61 2d 3e 78 |lt..poin|tData->x|
|00004960| 20 3d 20 66 66 28 70 6f | 69 6e 74 44 61 74 61 2d | = ff(po|intData-|
|00004970| 3e 78 29 3b 20 09 2f 2f | 20 63 6f 6e 76 65 72 74 |>x); .//| convert|
|00004980| 20 62 61 63 6b 20 74 6f | 20 66 69 78 65 64 0d 09 | back to| fixed..|
|00004990| 70 6f 69 6e 74 44 61 74 | 61 2d 3e 79 20 2f 3d 20 |pointDat|a->y /= |
|000049a0| 67 72 69 64 2d 3e 79 3b | 20 09 09 09 2f 2f 20 69 |grid->y;| ...// i|
|000049b0| 6e 74 65 67 65 72 20 72 | 65 73 75 6c 74 0d 09 70 |nteger r|esult..p|
|000049c0| 6f 69 6e 74 44 61 74 61 | 2d 3e 79 20 3d 20 66 66 |ointData|->y = ff|
|000049d0| 28 70 6f 69 6e 74 44 61 | 74 61 2d 3e 79 29 3b 20 |(pointDa|ta->y); |
|000049e0| 09 2f 2f 20 63 6f 6e 76 | 65 72 74 20 62 61 63 6b |.// conv|ert back|
|000049f0| 20 74 6f 20 66 69 78 65 | 64 0d 7d 0d 0d 2f 2f 2d | to fixe|d.}..//-|
|00004a00| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004a10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004a20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004a30| 2d 2d 2d 0d 2f 2f 20 53 | 63 72 65 65 6e 20 74 6f |---.// S|creen to|
|00004a40| 20 6d 65 6d 6f 72 79 20 | 63 6f 6e 76 65 72 73 69 | memory |conversi|
|00004a50| 6f 6e 20 72 6f 75 74 69 | 6e 65 73 0d 0d 2f 2f 20 |on routi|nes..// |
|00004a60| 63 68 61 6e 67 65 20 74 | 68 65 20 6a 75 67 67 6c |change t|he juggl|
|00004a70| 65 72 4d 61 70 20 74 6f | 20 72 65 66 6c 65 63 74 |erMap to| reflect|
|00004a80| 20 61 20 6d 6f 76 65 64 | 20 6a 75 67 67 6c 65 72 | a moved| juggler|
|00004a90| 0d 76 6f 69 64 20 4d 6f | 76 65 4a 75 67 67 6c 65 |.void Mo|veJuggle|
|00004aa0| 72 49 6e 4d 61 70 28 4a | 75 67 67 6c 65 48 61 6e |rInMap(J|uggleHan|
|00004ab0| 64 6c 65 20 61 4a 75 67 | 67 6c 65 2c 20 73 68 6f |dle aJug|gle, sho|
|00004ac0| 72 74 20 77 68 69 63 68 | 4a 75 67 67 6c 65 72 2c |rt which|Juggler,|
|00004ad0| 0d 09 09 09 09 09 09 73 | 68 6f 72 74 20 66 72 6f |.......s|hort fro|
|00004ae0| 6d 52 6f 77 2c 20 73 68 | 6f 72 74 20 74 6f 52 6f |mRow, sh|ort toRo|
|00004af0| 77 29 0d 7b 0d 09 73 68 | 6f 72 74 20 72 6f 77 44 |w).{..sh|ort rowD|
|00004b00| 69 73 74 61 6e 63 65 2c | 20 69 6e 63 72 65 6d 65 |istance,| increme|
|00004b10| 6e 74 2c 20 69 6e 64 65 | 78 3b 0d 09 0d 09 2f 2f |nt, inde|x;....//|
|00004b20| 20 53 61 6e 69 74 79 20 | 43 68 65 63 6b 0d 20 09 | Sanity |Check. .|
|00004b30| 69 66 28 77 68 69 63 68 | 4a 75 67 67 6c 65 72 20 |if(which|Juggler |
|00004b40| 21 3d 20 52 6f 77 54 6f | 4a 75 67 67 6c 65 72 28 |!= RowTo|Juggler(|
|00004b50| 61 4a 75 67 67 6c 65 2c | 20 66 72 6f 6d 52 6f 77 |aJuggle,| fromRow|
|00004b60| 29 29 0d 09 7b 0d 09 09 | 53 79 73 42 65 65 70 28 |))..{...|SysBeep(|
|00004b70| 31 30 29 3b 0d 09 09 72 | 65 74 75 72 6e 3b 0d 09 |10);...r|eturn;..|
|00004b80| 7d 0d 0d 09 2f 2f 20 73 | 65 65 20 68 6f 77 20 66 |}...// s|ee how f|
|00004b90| 61 72 20 77 65 20 6d 6f | 76 65 64 0d 09 72 6f 77 |ar we mo|ved..row|
|00004ba0| 44 69 73 74 61 6e 63 65 | 20 3d 20 74 6f 52 6f 77 |Distance| = toRow|
|00004bb0| 20 2d 20 66 72 6f 6d 52 | 6f 77 3b 0d 09 0d 09 69 | - fromR|ow;....i|
|00004bc0| 6e 64 65 78 20 3d 20 66 | 72 6f 6d 52 6f 77 20 2d |ndex = f|romRow -|
|00004bd0| 20 31 3b 0d 09 69 66 28 | 72 6f 77 44 69 73 74 61 | 1;..if(|rowDista|
|00004be0| 6e 63 65 20 3c 20 30 29 | 0d 09 7b 0d 09 09 2f 2f |nce < 0)|..{...//|
|00004bf0| 20 6d 6f 76 69 6e 67 20 | 75 70 0d 09 09 69 6e 63 | moving |up...inc|
|00004c00| 72 65 6d 65 6e 74 20 3d | 20 2d 31 3b 0d 09 09 72 |rement =| -1;...r|
|00004c10| 6f 77 44 69 73 74 61 6e | 63 65 20 3d 20 2d 72 6f |owDistan|ce = -ro|
|00004c20| 77 44 69 73 74 61 6e 63 | 65 3b 0d 09 7d 0d 09 65 |wDistanc|e;..}..e|
|00004c30| 6c 73 65 0d 09 7b 0d 09 | 09 2f 2f 20 6d 6f 76 69 |lse..{..|.// movi|
|00004c40| 6e 67 20 64 6f 77 6e 0d | 09 09 69 6e 63 72 65 6d |ng down.|..increm|
|00004c50| 65 6e 74 20 3d 20 31 3b | 0d 09 7d 0d 09 0d 09 2f |ent = 1;|..}..../|
|00004c60| 2f 20 4d 6f 76 65 20 74 | 68 65 20 62 6c 6f 63 6b |/ Move t|he block|
|00004c70| 20 6f 66 20 6a 75 67 67 | 6c 65 72 73 20 62 65 74 | of jugg|lers bet|
|00004c80| 77 65 65 6e 20 74 68 65 | 20 66 72 6f 6d 20 61 6e |ween the| from an|
|00004c90| 64 20 74 6f 20 72 6f 77 | 73 0d 09 77 68 69 6c 65 |d to row|s..while|
|00004ca0| 28 72 6f 77 44 69 73 74 | 61 6e 63 65 2d 2d 20 3e |(rowDist|ance-- >|
|00004cb0| 20 30 29 0d 09 7b 0d 09 | 09 28 2a 61 4a 75 67 67 | 0)..{..|.(*aJugg|
|00004cc0| 6c 65 29 2d 3e 6a 75 67 | 67 6c 65 72 4d 61 70 5b |le)->jug|glerMap[|
|00004cd0| 69 6e 64 65 78 5d 20 3d | 20 28 2a 61 4a 75 67 67 |index] =| (*aJugg|
|00004ce0| 6c 65 29 2d 3e 6a 75 67 | 67 6c 65 72 4d 61 70 5b |le)->jug|glerMap[|
|00004cf0| 69 6e 64 65 78 20 2b 20 | 69 6e 63 72 65 6d 65 6e |index + |incremen|
|00004d00| 74 5d 3b 0d 09 09 69 6e | 64 65 78 20 2b 3d 20 69 |t];...in|dex += i|
|00004d10| 6e 63 72 65 6d 65 6e 74 | 3b 0d 09 7d 0d 09 0d 09 |ncrement|;..}....|
|00004d20| 2f 2f 20 69 6e 73 65 72 | 74 20 6d 6f 76 65 64 20 |// inser|t moved |
|00004d30| 6a 75 67 67 6c 65 72 20 | 69 6e 20 64 65 73 74 69 |juggler |in desti|
|00004d40| 6e 61 74 69 6f 6e 20 72 | 6f 77 0d 09 28 2a 61 4a |nation r|ow..(*aJ|
|00004d50| 75 67 67 6c 65 29 2d 3e | 6a 75 67 67 6c 65 72 4d |uggle)->|jugglerM|
|00004d60| 61 70 5b 74 6f 52 6f 77 | 20 2d 20 31 5d 20 3d 20 |ap[toRow| - 1] = |
|00004d70| 77 68 69 63 68 4a 75 67 | 67 6c 65 72 3b 0d 7d 09 |whichJug|gler;.}.|
|00004d80| 09 0d 0d 2f 2f 20 43 6f | 6e 76 65 72 74 20 61 20 |...// Co|nvert a |
|00004d90| 6a 75 67 67 6c 65 72 20 | 6e 75 6d 62 65 72 20 74 |juggler |number t|
|00004da0| 6f 20 61 20 72 6f 77 20 | 69 6e 20 74 68 65 20 6f |o a row |in the o|
|00004db0| 6e 73 63 72 65 65 6e 20 | 70 69 63 74 75 72 65 0d |nscreen |picture.|
|00004dc0| 73 68 6f 72 74 20 4a 75 | 67 67 6c 65 72 54 6f 52 |short Ju|gglerToR|
|00004dd0| 6f 77 28 4a 75 67 67 6c | 65 48 61 6e 64 6c 65 20 |ow(Juggl|eHandle |
|00004de0| 61 4a 75 67 67 6c 65 2c | 20 73 68 6f 72 74 20 6a |aJuggle,| short j|
|00004df0| 75 67 67 6c 65 72 29 0d | 7b 0d 09 73 68 6f 72 74 |uggler).|{..short|
|00004e00| 20 63 6f 75 6e 74 3b 0d | 09 0d 09 2f 2f 20 42 72 | count;.|...// Br|
|00004e10| 75 74 65 20 66 6f 72 63 | 65 20 61 6e 64 20 61 77 |ute forc|e and aw|
|00004e20| 6b 77 61 72 64 6e 65 73 | 73 3a 20 47 6f 20 74 68 |kwardnes|s: Go th|
|00004e30| 72 6f 75 67 68 20 74 68 | 65 20 6d 61 70 20 6c 6f |rough th|e map lo|
|00004e40| 6f 6b 69 6e 67 20 66 6f | 72 20 74 68 69 73 20 6a |oking fo|r this j|
|00004e50| 75 67 67 6c 65 72 0d 09 | 66 6f 72 28 63 6f 75 6e |uggler..|for(coun|
|00004e60| 74 20 3d 20 30 3b 20 63 | 6f 75 6e 74 20 3c 20 28 |t = 0; c|ount < (|
|00004e70| 2a 61 4a 75 67 67 6c 65 | 29 2d 3e 6e 75 6d 4a 75 |*aJuggle|)->numJu|
|00004e80| 67 67 6c 65 72 73 3b 20 | 63 6f 75 6e 74 2b 2b 29 |gglers; |count++)|
|00004e90| 0d 09 7b 0d 09 09 69 66 | 28 28 2a 61 4a 75 67 67 |..{...if|((*aJugg|
|00004ea0| 6c 65 29 2d 3e 6a 75 67 | 67 6c 65 72 4d 61 70 5b |le)->jug|glerMap[|
|00004eb0| 63 6f 75 6e 74 5d 20 3d | 3d 20 6a 75 67 67 6c 65 |count] =|= juggle|
|00004ec0| 72 29 0d 09 09 7b 0d 09 | 09 09 2f 2f 20 46 6f 75 |r)...{..|..// Fou|
|00004ed0| 6e 64 20 69 74 0d 09 09 | 09 72 65 74 75 72 6e 20 |nd it...|.return |
|00004ee0| 28 63 6f 75 6e 74 20 2b | 20 31 29 3b 0d 09 09 7d |(count +| 1);...}|
|00004ef0| 0d 09 7d 0d 09 72 65 74 | 75 72 6e 20 30 3b 0d 7d |..}..ret|urn 0;.}|
|00004f00| 0d 0d 2f 2f 20 43 6f 6e | 76 65 72 74 20 61 20 72 |..// Con|vert a r|
|00004f10| 6f 77 20 69 6e 20 74 68 | 65 20 6f 6e 73 63 72 65 |ow in th|e onscre|
|00004f20| 65 6e 20 70 69 63 74 75 | 72 65 20 74 6f 20 61 20 |en pictu|re to a |
|00004f30| 6a 75 67 67 6c 65 72 20 | 6e 75 6d 62 65 72 0d 73 |juggler |number.s|
|00004f40| 68 6f 72 74 20 52 6f 77 | 54 6f 4a 75 67 67 6c 65 |hort Row|ToJuggle|
|00004f50| 72 28 4a 75 67 67 6c 65 | 48 61 6e 64 6c 65 20 61 |r(Juggle|Handle a|
|00004f60| 4a 75 67 67 6c 65 2c 20 | 73 68 6f 72 74 20 72 6f |Juggle, |short ro|
|00004f70| 77 29 0d 7b 0d 09 2f 2f | 20 72 61 6e 67 65 20 63 |w).{..//| range c|
|00004f80| 68 65 63 6b 20 66 69 72 | 73 74 0d 09 69 66 28 72 |heck fir|st..if(r|
|00004f90| 6f 77 20 3c 20 31 20 7c | 7c 20 72 6f 77 20 3e 20 |ow < 1 ||| row > |
|00004fa0| 28 2a 61 4a 75 67 67 6c | 65 29 2d 3e 6e 75 6d 4a |(*aJuggl|e)->numJ|
|00004fb0| 75 67 67 6c 65 72 73 29 | 0d 09 09 72 65 74 75 72 |ugglers)|...retur|
|00004fc0| 6e 20 30 3b 0d 09 72 65 | 74 75 72 6e 20 28 2a 61 |n 0;..re|turn (*a|
|00004fd0| 4a 75 67 67 6c 65 29 2d | 3e 6a 75 67 67 6c 65 72 |Juggle)-|>juggler|
|00004fe0| 4d 61 70 5b 72 6f 77 20 | 2d 20 31 5d 3b 0d 7d 0d |Map[row |- 1];.}.|
|00004ff0| 0d 2f 2f 20 43 6f 6e 76 | 65 72 74 20 61 20 48 61 |.// Conv|ert a Ha|
|00005000| 6e 64 4c 6f 63 20 74 6f | 20 61 20 70 6f 69 6e 74 |ndLoc to| a point|
|00005010| 20 69 6e 20 74 68 65 20 | 76 69 65 77 20 70 6f 72 | in the |view por|
|00005020| 74 0d 76 6f 69 64 20 48 | 61 6e 64 4c 6f 63 54 6f |t.void H|andLocTo|
|00005030| 50 6f 69 6e 74 28 4a 75 | 67 67 6c 65 48 61 6e 64 |Point(Ju|ggleHand|
|00005040| 6c 65 20 61 4a 75 67 67 | 6c 65 2c 20 48 61 6e 64 |le aJugg|le, Hand|
|00005050| 4c 6f 63 20 2a 68 61 6e | 64 2c 20 67 78 50 6f 69 |Loc *han|d, gxPoi|
|00005060| 6e 74 20 2a 70 6f 69 6e | 74 29 0d 7b 0d 09 67 78 |nt *poin|t).{..gx|
|00005070| 50 6f 69 6e 74 09 09 67 | 72 69 64 20 3d 20 28 2a |Point..g|rid = (*|
|00005080| 61 4a 75 67 67 6c 65 29 | 2d 3e 67 72 69 64 50 74 |aJuggle)|->gridPt|
|00005090| 3b 0d 09 0d 09 2f 2f 20 | 54 68 65 20 78 20 63 6f |;....// |The x co|
|000050a0| 6f 72 64 20 69 73 20 73 | 69 6d 70 6c 79 20 28 74 |ord is s|imply (t|
|000050b0| 69 6d 65 20 2d 20 31 29 | 20 2a 20 78 67 72 69 64 |ime - 1)| * xgrid|
|000050c0| 2e 0d 09 70 6f 69 6e 74 | 2d 3e 78 20 3d 20 28 68 |...point|->x = (h|
|000050d0| 61 6e 64 2d 3e 74 69 6d | 65 20 2d 20 31 29 20 2a |and->tim|e - 1) *|
|000050e0| 20 67 72 69 64 2e 78 3b | 0d 09 0d 09 2f 2f 20 47 | grid.x;|....// G|
|000050f0| 65 74 20 74 68 65 20 70 | 6f 69 6e 74 20 62 79 20 |et the p|oint by |
|00005100| 66 69 72 73 74 20 67 65 | 74 74 69 6e 67 20 74 68 |first ge|tting th|
|00005110| 65 20 72 69 67 68 74 20 | 72 6f 77 2c 20 74 68 65 |e right |row, the|
|00005120| 6e 20 6d 75 6c 74 69 70 | 6c 79 69 6e 67 20 62 79 |n multip|lying by|
|00005130| 0d 09 2f 2f 20 74 68 65 | 20 67 72 69 64 20 73 70 |..// the| grid sp|
|00005140| 61 63 69 6e 67 2e 0d 09 | 70 6f 69 6e 74 2d 3e 79 |acing...|point->y|
|00005150| 20 3d 20 28 4a 75 67 67 | 6c 65 72 54 6f 52 6f 77 | = (Jugg|lerToRow|
|00005160| 28 61 4a 75 67 67 6c 65 | 2c 20 68 61 6e 64 2d 3e |(aJuggle|, hand->|
|00005170| 6a 75 67 67 6c 65 72 29 | 20 2d 20 31 29 20 2a 20 |juggler)| - 1) * |
|00005180| 67 72 69 64 2e 79 3b 0d | 7d 0d 0d 2f 2f 20 43 6f |grid.y;.|}..// Co|
|00005190| 6e 76 65 72 74 20 61 20 | 70 6f 69 6e 74 20 69 6e |nvert a |point in|
|000051a0| 20 74 68 65 20 76 69 65 | 77 50 6f 72 74 20 74 6f | the vie|wPort to|
|000051b0| 20 61 20 48 61 6e 64 4c | 6f 63 20 28 6e 6f 20 72 | a HandL|oc (no r|
|000051c0| 6f 75 6e 64 69 6e 67 2c | 20 74 68 65 20 70 6f 69 |ounding,| the poi|
|000051d0| 6e 74 20 69 73 20 0d 2f | 2f 20 61 73 73 75 6d 65 |nt is ./|/ assume|
|000051e0| 64 20 74 6f 20 62 65 20 | 67 72 69 64 64 65 64 20 |d to be |gridded |
|000051f0| 61 6c 72 65 61 64 79 29 | 0d 76 6f 69 64 20 50 6f |already)|.void Po|
|00005200| 69 6e 74 54 6f 48 61 6e | 64 4c 6f 63 28 4a 75 67 |intToHan|dLoc(Jug|
|00005210| 67 6c 65 48 61 6e 64 6c | 65 20 61 4a 75 67 67 6c |gleHandl|e aJuggl|
|00005220| 65 2c 20 67 78 50 6f 69 | 6e 74 20 2a 70 6f 69 6e |e, gxPoi|nt *poin|
|00005230| 74 2c 20 48 61 6e 64 4c | 6f 63 20 2a 68 61 6e 64 |t, HandL|oc *hand|
|00005240| 2c 0d 09 09 09 09 09 09 | 42 6f 6f 6c 65 61 6e 20 |,.......|Boolean |
|00005250| 77 72 61 70 49 74 29 0d | 7b 0d 09 67 78 50 6f 69 |wrapIt).|{..gxPoi|
|00005260| 6e 74 09 09 67 72 69 64 | 20 3d 20 28 2a 61 4a 75 |nt..grid| = (*aJu|
|00005270| 67 67 6c 65 29 2d 3e 67 | 72 69 64 50 74 3b 0d 09 |ggle)->g|ridPt;..|
|00005280| 0d 09 2f 2f 20 54 68 65 | 20 74 69 6d 65 20 69 73 |..// The| time is|
|00005290| 20 73 69 6d 70 6c 79 20 | 74 68 65 20 70 6f 69 6e | simply |the poin|
|000052a0| 74 27 73 20 78 20 63 6f | 6f 72 64 20 64 69 76 69 |t's x co|ord divi|
|000052b0| 64 65 64 20 62 79 20 74 | 68 65 20 67 72 69 64 2e |ded by t|he grid.|
|000052c0| 0d 09 2f 2f 20 28 61 64 | 6a 75 73 74 65 64 20 75 |..// (ad|justed u|
|000052d0| 70 20 66 6f 72 20 61 20 | 31 2d 62 61 73 65 64 20 |p for a |1-based |
|000052e0| 74 69 6d 65 20 6c 6f 63 | 61 74 69 6f 6e 29 0d 09 |time loc|ation)..|
|000052f0| 2f 2f 20 44 69 76 69 64 | 65 20 61 20 46 69 78 65 |// Divid|e a Fixe|
|00005300| 64 20 62 79 20 61 20 46 | 69 78 65 64 20 61 6e 64 |d by a F|ixed and|
|00005310| 20 79 6f 75 20 67 65 74 | 20 61 6e 20 69 6e 74 65 | you get| an inte|
|00005320| 67 65 72 20 72 65 73 75 | 6c 74 0d 09 68 61 6e 64 |ger resu|lt..hand|
|00005330| 2d 3e 74 69 6d 65 20 3d | 20 28 70 6f 69 6e 74 2d |->time =| (point-|
|00005340| 3e 78 20 2f 20 67 72 69 | 64 2e 78 29 20 2b 20 31 |>x / gri|d.x) + 1|
|00005350| 3b 0d 09 2f 2f 20 72 61 | 6e 67 65 20 63 68 65 63 |;..// ra|nge chec|
|00005360| 6b 0d 09 69 66 28 68 61 | 6e 64 2d 3e 74 69 6d 65 |k..if(ha|nd->time|
|00005370| 20 3d 3d 20 30 29 20 2f | 2f 20 6c 61 62 65 6c 20 | == 0) /|/ label |
|00005380| 68 69 74 0d 09 09 68 61 | 6e 64 2d 3e 74 69 6d 65 |hit...ha|nd->time|
|00005390| 20 3d 20 2d 31 3b 09 2f | 2f 20 73 69 67 6e 61 6c | = -1;./|/ signal|
|000053a0| 20 74 6f 20 63 61 6c 6c | 65 72 20 74 68 61 74 20 | to call|er that |
|000053b0| 6c 61 62 65 6c 20 77 61 | 73 20 68 69 74 0d 09 2f |label wa|s hit../|
|000053c0| 2f 20 69 66 20 6f 66 66 | 20 74 68 65 20 72 69 67 |/ if off| the rig|
|000053d0| 68 74 20 65 64 67 65 0d | 09 65 6c 73 65 20 69 66 |ht edge.|.else if|
|000053e0| 28 68 61 6e 64 2d 3e 74 | 69 6d 65 20 3e 20 28 2a |(hand->t|ime > (*|
|000053f0| 61 4a 75 67 67 6c 65 29 | 2d 3e 6e 75 6d 43 6f 75 |aJuggle)|->numCou|
|00005400| 6e 74 73 29 0d 09 7b 0d | 09 09 2f 2f 20 69 66 20 |nts)..{.|..// if |
|00005410| 77 72 61 70 70 69 6e 67 | 2c 20 6d 61 6b 65 20 69 |wrapping|, make i|
|00005420| 74 20 61 20 6c 65 67 61 | 6c 20 74 69 6d 65 2c 20 |t a lega|l time, |
|00005430| 65 6c 73 65 20 6f 75 74 | 20 6f 66 20 72 61 6e 67 |else out| of rang|
|00005440| 65 2c 20 6d 61 6b 65 20 | 69 74 20 30 0d 09 09 69 |e, make |it 0...i|
|00005450| 66 28 77 72 61 70 49 74 | 29 0d 09 09 7b 0d 09 09 |f(wrapIt|)...{...|
|00005460| 09 68 61 6e 64 2d 3e 74 | 69 6d 65 20 25 3d 20 28 |.hand->t|ime %= (|
|00005470| 2a 61 4a 75 67 67 6c 65 | 29 2d 3e 6e 75 6d 43 6f |*aJuggle|)->numCo|
|00005480| 75 6e 74 73 3b 20 2f 2f | 20 6b 65 65 70 20 69 6e |unts; //| keep in|
|00005490| 20 72 61 6e 67 65 0d 09 | 09 09 2f 2f 20 21 21 21 | range..|..// !!!|
|000054a0| 20 69 66 20 69 74 27 73 | 20 7a 65 72 6f 2c 20 77 | if it's| zero, w|
|000054b0| 65 27 76 65 20 68 69 74 | 20 61 20 73 70 65 63 69 |e've hit| a speci|
|000054c0| 61 6c 20 63 61 73 65 3a | 20 74 68 65 20 6c 61 73 |al case:| the las|
|000054d0| 74 20 66 61 64 65 64 0d | 09 09 09 2f 2f 20 6a 75 |t faded.|...// ju|
|000054e0| 67 67 6c 65 72 20 6f 6e | 20 74 68 65 20 72 69 67 |ggler on| the rig|
|000054f0| 68 74 2e 20 49 74 20 73 | 68 6f 75 6c 64 20 72 65 |ht. It s|hould re|
|00005500| 61 6c 6c 79 20 77 72 61 | 70 20 74 6f 20 74 68 65 |ally wra|p to the|
|00005510| 20 6c 61 73 74 20 73 6f | 6c 69 64 0d 09 09 09 2f | last so|lid..../|
|00005520| 2f 20 6a 75 67 67 6c 65 | 72 20 6f 6e 20 74 68 65 |/ juggle|r on the|
|00005530| 20 72 69 67 68 74 2e 0d | 09 09 09 69 66 28 68 61 | right..|...if(ha|
|00005540| 6e 64 2d 3e 74 69 6d 65 | 20 3d 3d 20 30 29 0d 09 |nd->time| == 0)..|
|00005550| 09 09 09 68 61 6e 64 2d | 3e 74 69 6d 65 20 3d 20 |...hand-|>time = |
|00005560| 28 2a 61 4a 75 67 67 6c | 65 29 2d 3e 6e 75 6d 43 |(*aJuggl|e)->numC|
|00005570| 6f 75 6e 74 73 3b 0d 09 | 09 7d 0d 09 09 65 6c 73 |ounts;..|.}...els|
|00005580| 65 0d 09 09 09 68 61 6e | 64 2d 3e 74 69 6d 65 20 |e....han|d->time |
|00005590| 3d 20 30 3b 0d 09 7d 0d | 09 65 6c 73 65 20 69 66 |= 0;..}.|.else if|
|000055a0| 28 68 61 6e 64 2d 3e 74 | 69 6d 65 20 3c 20 30 29 |(hand->t|ime < 0)|
|000055b0| 0d 09 09 68 61 6e 64 2d | 3e 74 69 6d 65 20 3d 20 |...hand-|>time = |
|000055c0| 30 3b 0d 09 0d 09 2f 2f | 20 47 65 74 20 74 68 65 |0;....//| Get the|
|000055d0| 20 6a 75 67 67 6c 65 72 | 20 62 79 20 66 69 72 73 | juggler| by firs|
|000055e0| 74 20 64 69 76 69 64 69 | 6e 67 20 74 6f 20 67 65 |t dividi|ng to ge|
|000055f0| 74 20 74 68 65 20 28 31 | 2d 62 61 73 65 64 29 20 |t the (1|-based) |
|00005600| 72 6f 77 2c 20 74 68 65 | 6e 20 63 6f 6e 76 65 72 |row, the|n conver|
|00005610| 74 69 6e 67 0d 09 68 61 | 6e 64 2d 3e 6a 75 67 67 |ting..ha|nd->jugg|
|00005620| 6c 65 72 20 3d 20 52 6f | 77 54 6f 4a 75 67 67 6c |ler = Ro|wToJuggl|
|00005630| 65 72 28 61 4a 75 67 67 | 6c 65 2c 20 28 70 6f 69 |er(aJugg|le, (poi|
|00005640| 6e 74 2d 3e 79 20 2f 20 | 67 72 69 64 2e 79 29 20 |nt->y / |grid.y) |
|00005650| 2b 20 31 29 3b 0d 7d 0d | 0d 2f 2f 20 47 69 76 65 |+ 1);.}.|.// Give|
|00005660| 6e 20 74 68 65 20 70 6f | 69 6e 74 20 6f 6e 20 73 |n the po|int on s|
|00005670| 63 72 65 65 6e 2c 20 72 | 65 74 75 72 6e 20 61 20 |creen, r|eturn a |
|00005680| 70 6f 69 6e 74 65 72 20 | 74 6f 20 74 68 65 20 73 |pointer |to the s|
|00005690| 70 65 63 69 66 69 63 20 | 68 61 6e 64 0d 2f 2f 20 |pecific |hand.// |
|000056a0| 28 6e 6f 20 72 6f 75 6e | 64 69 6e 67 2c 20 74 68 |(no roun|ding, th|
|000056b0| 65 20 70 6f 69 6e 74 20 | 69 73 20 61 73 73 75 6d |e point |is assum|
|000056c0| 65 64 20 74 6f 20 62 65 | 20 22 67 72 69 64 64 65 |ed to be| "gridde|
|000056d0| 64 22 20 61 6c 72 65 61 | 64 79 29 0d 48 61 6e 64 |d" alrea|dy).Hand|
|000056e0| 50 74 72 20 50 6f 69 6e | 74 54 6f 48 61 6e 64 28 |Ptr Poin|tToHand(|
|000056f0| 4a 75 67 67 6c 65 48 61 | 6e 64 6c 65 20 61 4a 75 |JuggleHa|ndle aJu|
|00005700| 67 67 6c 65 2c 20 67 78 | 50 6f 69 6e 74 20 2a 70 |ggle, gx|Point *p|
|00005710| 6f 69 6e 74 2c 20 42 6f | 6f 6c 65 61 6e 20 77 72 |oint, Bo|olean wr|
|00005720| 61 70 49 74 29 0d 7b 0d | 09 48 61 6e 64 4c 6f 63 |apIt).{.|.HandLoc|
|00005730| 09 61 4c 6f 63 3b 0d 09 | 0d 09 50 6f 69 6e 74 54 |.aLoc;..|..PointT|
|00005740| 6f 48 61 6e 64 4c 6f 63 | 28 61 4a 75 67 67 6c 65 |oHandLoc|(aJuggle|
|00005750| 2c 20 70 6f 69 6e 74 2c | 20 26 61 4c 6f 63 2c 20 |, point,| &aLoc, |
|00005760| 77 72 61 70 49 74 29 3b | 0d 09 72 65 74 75 72 6e |wrapIt);|..return|
|00005770| 20 47 65 74 48 61 6e 64 | 28 61 4a 75 67 67 6c 65 | GetHand|(aJuggle|
|00005780| 2c 20 61 4c 6f 63 2c 20 | 77 72 61 70 49 74 29 3b |, aLoc, |wrapIt);|
|00005790| 0d 7d 0d 0d 2f 2f 20 43 | 6f 6e 76 65 6e 69 65 6e |.}..// C|onvenien|
|000057a0| 63 65 20 72 6f 75 74 69 | 6e 65 20 74 68 61 74 20 |ce routi|ne that |
|000057b0| 74 61 6b 65 73 20 61 20 | 67 78 4c 69 6e 65 20 69 |takes a |gxLine i|
|000057c0| 6e 73 74 65 61 64 20 6f | 66 20 74 77 6f 20 48 61 |nstead o|f two Ha|
|000057d0| 6e 64 4c 6f 63 73 0d 76 | 6f 69 64 20 4c 69 6e 65 |ndLocs.v|oid Line|
|000057e0| 54 6f 41 64 64 65 64 54 | 68 72 6f 77 28 4a 75 67 |ToAddedT|hrow(Jug|
|000057f0| 67 6c 65 48 61 6e 64 6c | 65 20 61 4a 75 67 67 6c |gleHandl|e aJuggl|
|00005800| 65 2c 20 67 78 4c 69 6e | 65 20 2a 6c 69 6e 65 29 |e, gxLin|e *line)|
|00005810| 0d 7b 0d 09 48 61 6e 64 | 4c 6f 63 09 66 72 6f 6d |.{..Hand|Loc.from|
|00005820| 2c 20 74 6f 3b 0d 09 67 | 78 4c 69 6e 65 09 67 72 |, to;..g|xLine.gr|
|00005830| 69 64 4c 69 6e 65 3b 0d | 09 0d 09 2f 2f 20 4c 69 |idLine;.|...// Li|
|00005840| 6e 65 20 64 6f 65 73 6e | 27 74 20 72 65 61 6c 6c |ne doesn|'t reall|
|00005850| 79 20 72 65 61 63 68 20 | 67 72 69 64 20 70 6f 69 |y reach |grid poi|
|00005860| 6e 74 73 2c 20 73 6f 20 | 67 72 69 64 20 69 74 0d |nts, so |grid it.|
|00005870| 09 67 72 69 64 4c 69 6e | 65 20 3d 20 2a 6c 69 6e |.gridLin|e = *lin|
|00005880| 65 3b 0d 09 67 72 69 64 | 4c 69 6e 65 2e 66 69 72 |e;..grid|Line.fir|
|00005890| 73 74 2e 78 20 2d 3d 20 | 6b 48 61 6e 64 52 61 64 |st.x -= |kHandRad|
|000058a0| 69 75 73 3b 0d 09 67 72 | 69 64 4c 69 6e 65 2e 6c |ius;..gr|idLine.l|
|000058b0| 61 73 74 2e 78 20 2b 3d | 20 6b 48 61 6e 64 52 61 |ast.x +=| kHandRa|
|000058c0| 64 69 75 73 3b 0d 09 0d | 09 2f 2f 20 63 6f 6e 76 |dius;...|.// conv|
|000058d0| 65 72 74 20 70 6f 69 6e | 74 73 20 74 6f 20 48 61 |ert poin|ts to Ha|
|000058e0| 6e 64 4c 6f 63 73 2c 20 | 77 72 61 70 70 69 6e 67 |ndLocs, |wrapping|
|000058f0| 20 74 68 65 6d 20 61 72 | 6f 75 6e 64 0d 09 50 6f | them ar|ound..Po|
|00005900| 69 6e 74 54 6f 48 61 6e | 64 4c 6f 63 28 61 4a 75 |intToHan|dLoc(aJu|
|00005910| 67 67 6c 65 2c 20 26 67 | 72 69 64 4c 69 6e 65 2e |ggle, &g|ridLine.|
|00005920| 66 69 72 73 74 2c 20 26 | 66 72 6f 6d 2c 20 74 72 |first, &|from, tr|
|00005930| 75 65 29 3b 0d 09 50 6f | 69 6e 74 54 6f 48 61 6e |ue);..Po|intToHan|
|00005940| 64 4c 6f 63 28 61 4a 75 | 67 67 6c 65 2c 20 26 67 |dLoc(aJu|ggle, &g|
|00005950| 72 69 64 4c 69 6e 65 2e | 6c 61 73 74 2c 20 26 74 |ridLine.|last, &t|
|00005960| 6f 2c 20 74 72 75 65 29 | 3b 0d 0d 09 41 64 64 54 |o, true)|;...AddT|
|00005970| 68 72 6f 77 28 61 4a 75 | 67 67 6c 65 2c 20 66 72 |hrow(aJu|ggle, fr|
|00005980| 6f 6d 2c 20 74 6f 29 3b | 0d 7d 0d 0d 2f 2f 20 43 |om, to);|.}..// C|
|00005990| 6f 6e 76 65 6e 69 65 6e | 63 65 20 72 6f 75 74 69 |onvenien|ce routi|
|000059a0| 6e 65 20 74 68 61 74 20 | 74 61 6b 65 73 20 61 20 |ne that |takes a |
|000059b0| 67 78 4c 69 6e 65 20 69 | 6e 73 74 65 61 64 20 6f |gxLine i|nstead o|
|000059c0| 66 20 74 77 6f 20 48 61 | 6e 64 4c 6f 63 73 0d 76 |f two Ha|ndLocs.v|
|000059d0| 6f 69 64 20 4c 69 6e 65 | 54 6f 52 65 6d 6f 76 65 |oid Line|ToRemove|
|000059e0| 64 54 68 72 6f 77 28 4a | 75 67 67 6c 65 48 61 6e |dThrow(J|uggleHan|
|000059f0| 64 6c 65 20 61 4a 75 67 | 67 6c 65 2c 20 67 78 4c |dle aJug|gle, gxL|
|00005a00| 69 6e 65 20 2a 6c 69 6e | 65 29 0d 7b 0d 09 48 61 |ine *lin|e).{..Ha|
|00005a10| 6e 64 4c 6f 63 09 66 72 | 6f 6d 2c 20 74 6f 3b 0d |ndLoc.fr|om, to;.|
|00005a20| 09 67 78 4c 69 6e 65 09 | 67 72 69 64 4c 69 6e 65 |.gxLine.|gridLine|
|00005a30| 3b 0d 09 0d 09 2f 2f 20 | 4c 69 6e 65 20 64 6f 65 |;....// |Line doe|
|00005a40| 73 6e 27 74 20 72 65 61 | 6c 6c 79 20 72 65 61 63 |sn't rea|lly reac|
|00005a50| 68 20 67 72 69 64 20 70 | 6f 69 6e 74 73 2c 20 73 |h grid p|oints, s|
|00005a60| 6f 20 67 72 69 64 20 69 | 74 0d 09 67 72 69 64 4c |o grid i|t..gridL|
|00005a70| 69 6e 65 20 3d 20 2a 6c | 69 6e 65 3b 0d 09 67 72 |ine = *l|ine;..gr|
|00005a80| 69 64 4c 69 6e 65 2e 66 | 69 72 73 74 2e 78 20 2d |idLine.f|irst.x -|
|00005a90| 3d 20 6b 48 61 6e 64 52 | 61 64 69 75 73 3b 0d 09 |= kHandR|adius;..|
|00005aa0| 67 72 69 64 4c 69 6e 65 | 2e 6c 61 73 74 2e 78 20 |gridLine|.last.x |
|00005ab0| 2b 3d 20 6b 48 61 6e 64 | 52 61 64 69 75 73 3b 0d |+= kHand|Radius;.|
|00005ac0| 09 0d 09 2f 2f 20 63 6f | 6e 76 65 72 74 20 70 6f |...// co|nvert po|
|00005ad0| 69 6e 74 73 20 74 6f 20 | 48 61 6e 64 4c 6f 63 73 |ints to |HandLocs|
|00005ae0| 2c 20 77 72 61 70 70 69 | 6e 67 20 74 68 65 6d 20 |, wrappi|ng them |
|00005af0| 61 72 6f 75 6e 64 0d 09 | 50 6f 69 6e 74 54 6f 48 |around..|PointToH|
|00005b00| 61 6e 64 4c 6f 63 28 61 | 4a 75 67 67 6c 65 2c 20 |andLoc(a|Juggle, |
|00005b10| 26 67 72 69 64 4c 69 6e | 65 2e 66 69 72 73 74 2c |&gridLin|e.first,|
|00005b20| 20 26 66 72 6f 6d 2c 20 | 74 72 75 65 29 3b 0d 09 | &from, |true);..|
|00005b30| 50 6f 69 6e 74 54 6f 48 | 61 6e 64 4c 6f 63 28 61 |PointToH|andLoc(a|
|00005b40| 4a 75 67 67 6c 65 2c 20 | 26 67 72 69 64 4c 69 6e |Juggle, |&gridLin|
|00005b50| 65 2e 6c 61 73 74 2c 20 | 26 74 6f 2c 20 74 72 75 |e.last, |&to, tru|
|00005b60| 65 29 3b 0d 0d 09 52 65 | 6d 6f 76 65 54 68 72 6f |e);...Re|moveThro|
|00005b70| 77 28 61 4a 75 67 67 6c | 65 2c 20 66 72 6f 6d 2c |w(aJuggl|e, from,|
|00005b80| 20 74 6f 29 3b 0d 7d 0d | 0d 2f 2f 2d 2d 2d 2d 2d | to);.}.|.//-----|
|00005b90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005ba0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005bb0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|00005bc0| 2f 2f 20 44 69 61 6c 6f | 67 20 72 6f 75 74 69 6e |// Dialo|g routin|
|00005bd0| 65 73 0d 0d 2f 2f 20 41 | 73 6b 20 74 68 65 20 75 |es..// A|sk the u|
|00005be0| 73 65 72 20 68 6f 77 20 | 62 69 67 20 74 6f 20 6d |ser how |big to m|
|00005bf0| 61 6b 65 20 74 68 65 20 | 6a 75 67 67 6c 65 2c 20 |ake the |juggle, |
|00005c00| 72 65 74 75 72 6e 20 7a | 65 72 6f 20 69 66 20 74 |return z|ero if t|
|00005c10| 68 65 79 20 63 61 6e 63 | 65 6c 0d 76 6f 69 64 20 |hey canc|el.void |
|00005c20| 44 6f 4a 75 67 67 6c 65 | 53 69 7a 65 44 69 61 6c |DoJuggle|SizeDial|
|00005c30| 6f 67 28 73 68 6f 72 74 | 20 2a 6e 75 6d 4a 75 67 |og(short| *numJug|
|00005c40| 67 6c 65 72 73 2c 20 73 | 68 6f 72 74 20 2a 6e 75 |glers, s|hort *nu|
|00005c50| 6d 43 6f 75 6e 74 73 29 | 0d 7b 0d 09 44 69 61 6c |mCounts)|.{..Dial|
|00005c60| 6f 67 50 74 72 09 09 09 | 74 68 65 44 6c 6f 67 3b |ogPtr...|theDlog;|
|00005c70| 0d 09 73 68 6f 72 74 09 | 09 09 09 68 69 74 2c 20 |..short.|...hit, |
|00005c80| 6b 69 6e 64 3b 0d 09 48 | 61 6e 64 6c 65 09 09 09 |kind;..H|andle...|
|00005c90| 09 69 74 6d 68 6e 64 6c | 3b 0d 09 52 65 63 74 09 |.itmhndl|;..Rect.|
|00005ca0| 09 09 09 72 65 63 74 3b | 0d 09 47 72 61 66 50 74 |...rect;|..GrafPt|
|00005cb0| 72 09 09 09 09 6f 6c 64 | 70 6f 72 74 3b 0d 09 55 |r....old|port;..U|
|00005cc0| 73 65 72 49 74 65 6d 55 | 50 50 09 09 09 6f 75 74 |serItemU|PP...out|
|00005cd0| 6c 69 6e 65 55 50 50 3b | 0d 09 4d 6f 64 61 6c 46 |lineUPP;|..ModalF|
|00005ce0| 69 6c 74 65 72 55 50 50 | 09 09 6e 75 6d 46 69 6c |ilterUPP|..numFil|
|00005cf0| 74 65 72 55 50 50 3b 0d | 09 42 6f 6f 6c 65 61 6e |terUPP;.|.Boolean|
|00005d00| 20 09 09 09 65 78 69 74 | 44 69 61 6c 6f 67 20 3d | ...exit|Dialog =|
|00005d10| 20 66 61 6c 73 65 3b 0d | 09 73 68 6f 72 74 09 09 | false;.|.short..|
|00005d20| 09 09 73 74 61 72 74 4a | 75 67 67 6c 65 72 73 20 |..startJ|ugglers |
|00005d30| 3d 20 6b 44 65 66 61 75 | 6c 74 4a 75 67 67 6c 65 |= kDefau|ltJuggle|
|00005d40| 72 73 2c 20 73 74 61 72 | 74 43 6f 75 6e 74 73 20 |rs, star|tCounts |
|00005d50| 3d 20 6b 44 65 66 61 75 | 6c 74 43 6f 75 6e 74 73 |= kDefau|ltCounts|
|00005d60| 3b 0d 09 0d 09 57 69 6e | 64 6f 77 50 74 72 09 09 |;....Win|dowPtr..|
|00005d70| 09 66 72 6f 6e 74 57 69 | 6e 64 3b 0d 09 4a 75 67 |.frontWi|nd;..Jug|
|00005d80| 67 6c 65 48 61 6e 64 6c | 65 09 09 61 4a 75 67 67 |gleHandl|e..aJugg|
|00005d90| 6c 65 3b 0d 09 09 0d 09 | 0d 09 2f 2f 20 41 73 73 |le;.....|..// Ass|
|00005da0| 75 6d 65 20 66 61 69 6c | 75 72 65 0d 09 2a 6e 75 |ume fail|ure..*nu|
|00005db0| 6d 4a 75 67 67 6c 65 72 | 73 20 3d 20 2a 6e 75 6d |mJuggler|s = *num|
|00005dc0| 43 6f 75 6e 74 73 20 3d | 20 30 3b 0d 09 0d 09 2f |Counts =| 0;..../|
|00005dd0| 2a 20 53 61 76 65 20 74 | 68 65 20 63 75 72 72 65 |* Save t|he curre|
|00005de0| 6e 74 20 70 6f 72 74 20 | 2a 2f 0d 09 47 65 74 50 |nt port |*/..GetP|
|00005df0| 6f 72 74 28 26 6f 6c 64 | 70 6f 72 74 29 3b 0d 09 |ort(&old|port);..|
|00005e00| 0d 09 2f 2f 20 47 65 74 | 20 74 68 65 20 73 69 7a |..// Get| the siz|
|00005e10| 65 20 6f 66 20 74 68 65 | 20 66 72 6f 6e 74 20 6a |e of the| front j|
|00005e20| 75 67 67 6c 65 2c 20 69 | 66 20 74 68 65 72 65 20 |uggle, i|f there |
|00005e30| 69 73 20 6f 6e 65 2e 0d | 09 66 72 6f 6e 74 57 69 |is one..|.frontWi|
|00005e40| 6e 64 20 3d 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 |nd = Fro|ntWindow|
|00005e50| 28 29 3b 0d 09 61 4a 75 | 67 67 6c 65 20 3d 20 47 |();..aJu|ggle = G|
|00005e60| 65 74 57 69 6e 64 6f 77 | 4a 75 67 67 6c 65 28 66 |etWindow|Juggle(f|
|00005e70| 72 6f 6e 74 57 69 6e 64 | 29 3b 0d 09 69 66 28 61 |rontWind|);..if(a|
|00005e80| 4a 75 67 67 6c 65 20 21 | 3d 20 6e 69 6c 29 0d 09 |Juggle !|= nil)..|
|00005e90| 7b 0d 09 09 73 74 61 72 | 74 4a 75 67 67 6c 65 72 |{...star|tJuggler|
|00005ea0| 73 20 3d 20 28 2a 61 4a | 75 67 67 6c 65 29 2d 3e |s = (*aJ|uggle)->|
|00005eb0| 6e 75 6d 4a 75 67 67 6c | 65 72 73 3b 0d 09 09 73 |numJuggl|ers;...s|
|00005ec0| 74 61 72 74 43 6f 75 6e | 74 73 20 3d 20 28 2a 61 |tartCoun|ts = (*a|
|00005ed0| 4a 75 67 67 6c 65 29 2d | 3e 6e 75 6d 43 6f 75 6e |Juggle)-|>numCoun|
|00005ee0| 74 73 3b 0d 09 7d 0d 09 | 0d 09 2f 2a 20 47 65 74 |ts;..}..|../* Get|
|00005ef0| 20 74 68 65 20 64 69 61 | 6c 6f 67 20 28 69 6e 76 | the dia|log (inv|
|00005f00| 69 73 69 62 6c 65 29 20 | 2a 2f 0d 09 74 68 65 44 |isible) |*/..theD|
|00005f10| 6c 6f 67 20 3d 20 47 65 | 74 4e 65 77 44 69 61 6c |log = Ge|tNewDial|
|00005f20| 6f 67 28 6b 4a 75 67 67 | 6c 65 53 69 7a 65 44 69 |og(kJugg|leSizeDi|
|00005f30| 61 6c 6f 67 49 64 2c 20 | 6e 69 6c 2c 20 28 57 69 |alogId, |nil, (Wi|
|00005f40| 6e 64 6f 77 50 74 72 29 | 28 2d 31 29 29 3b 0d 09 |ndowPtr)|(-1));..|
|00005f50| 69 66 28 74 68 65 44 6c | 6f 67 20 3d 3d 20 6e 69 |if(theDl|og == ni|
|00005f60| 6c 29 0d 09 09 72 65 74 | 75 72 6e 3b 0d 09 0d 09 |l)...ret|urn;....|
|00005f70| 2f 2f 20 53 65 74 20 75 | 70 20 55 50 50 73 0d 09 |// Set u|p UPPs..|
|00005f80| 6f 75 74 6c 69 6e 65 55 | 50 50 20 3d 20 4e 65 77 |outlineU|PP = New|
|00005f90| 55 73 65 72 49 74 65 6d | 50 72 6f 63 28 42 74 6e |UserItem|Proc(Btn|
|00005fa0| 49 74 65 6d 29 3b 0d 09 | 6e 75 6d 46 69 6c 74 65 |Item);..|numFilte|
|00005fb0| 72 55 50 50 20 3d 20 4e | 65 77 4d 6f 64 61 6c 46 |rUPP = N|ewModalF|
|00005fc0| 69 6c 74 65 72 50 72 6f | 63 28 4e 75 6d 46 69 6c |ilterPro|c(NumFil|
|00005fd0| 74 65 72 29 3b 0d 09 0d | 09 2f 2a 20 49 6e 73 74 |ter);...|./* Inst|
|00005fe0| 61 6c 6c 20 4f 4b 20 62 | 75 74 74 6f 6e 20 4f 75 |all OK b|utton Ou|
|00005ff0| 74 6c 69 6e 65 20 2a 2f | 0d 09 47 65 74 44 69 61 |tline */|..GetDia|
|00006000| 6c 6f 67 49 74 65 6d 28 | 74 68 65 44 6c 6f 67 2c |logItem(|theDlog,|
|00006010| 20 69 4f 4b 4f 75 74 6c | 69 6e 65 2c 20 26 6b 69 | iOKOutl|ine, &ki|
|00006020| 6e 64 2c 20 26 69 74 6d | 68 6e 64 6c 2c 20 26 72 |nd, &itm|hndl, &r|
|00006030| 65 63 74 29 3b 0d 09 53 | 65 74 44 69 61 6c 6f 67 |ect);..S|etDialog|
|00006040| 49 74 65 6d 28 74 68 65 | 44 6c 6f 67 2c 20 69 4f |Item(the|Dlog, iO|
|00006050| 4b 4f 75 74 6c 69 6e 65 | 2c 20 75 73 65 72 49 74 |KOutline|, userIt|
|00006060| 65 6d 2c 20 28 48 61 6e | 64 6c 65 29 6f 75 74 6c |em, (Han|dle)outl|
|00006070| 69 6e 65 55 50 50 2c 20 | 26 72 65 63 74 29 3b 0d |ineUPP, |&rect);.|
|00006080| 09 0d 09 2f 2a 20 4f 74 | 68 65 72 20 75 73 65 72 |.../* Ot|her user|
|00006090| 20 49 74 65 6d 73 2e 2e | 2e 20 2a 2f 0d 09 0d 09 | Items..|. */....|
|000060a0| 2f 2a 20 53 65 74 20 56 | 61 6c 75 65 73 20 6f 66 |/* Set V|alues of|
|000060b0| 20 74 65 78 74 20 69 74 | 65 6d 73 2e 2e 2e 20 2a | text it|ems... *|
|000060c0| 2f 0d 09 53 68 6f 72 74 | 54 6f 44 6c 6f 67 28 73 |/..Short|ToDlog(s|
|000060d0| 74 61 72 74 4a 75 67 67 | 6c 65 72 73 2c 20 74 68 |tartJugg|lers, th|
|000060e0| 65 44 6c 6f 67 2c 20 69 | 4e 75 6d 4a 75 67 67 6c |eDlog, i|NumJuggl|
|000060f0| 65 72 73 29 3b 0d 09 53 | 68 6f 72 74 54 6f 44 6c |ers);..S|hortToDl|
|00006100| 6f 67 28 73 74 61 72 74 | 43 6f 75 6e 74 73 2c 20 |og(start|Counts, |
|00006110| 74 68 65 44 6c 6f 67 2c | 20 69 4e 75 6d 43 6f 75 |theDlog,| iNumCou|
|00006120| 6e 74 73 29 3b 0d 09 09 | 0d 09 2f 2a 20 44 6f 20 |nts);...|../* Do |
|00006130| 69 74 2e 2e 2e 20 2a 2f | 0d 09 53 65 6c 65 63 74 |it... */|..Select|
|00006140| 44 69 61 6c 6f 67 49 74 | 65 6d 54 65 78 74 28 74 |DialogIt|emText(t|
|00006150| 68 65 44 6c 6f 67 2c 20 | 69 4e 75 6d 4a 75 67 67 |heDlog, |iNumJugg|
|00006160| 6c 65 72 73 2c 20 30 2c | 20 33 32 37 36 37 29 3b |lers, 0,| 32767);|
|00006170| 0d 09 53 68 6f 77 57 69 | 6e 64 6f 77 28 74 68 65 |..ShowWi|ndow(the|
|00006180| 44 6c 6f 67 29 3b 0d 09 | 77 68 69 6c 65 28 21 65 |Dlog);..|while(!e|
|00006190| 78 69 74 44 69 61 6c 6f | 67 29 09 09 09 09 09 09 |xitDialo|g)......|
|000061a0| 09 09 09 2f 2a 20 4c 6f | 6f 70 20 75 6e 74 69 6c |.../* Lo|op until|
|000061b0| 20 62 72 65 61 6b 2e 2e | 2e 2a 2f 0d 09 7b 0d 09 | break..|.*/..{..|
|000061c0| 09 4d 6f 64 61 6c 44 69 | 61 6c 6f 67 28 6e 75 6d |.ModalDi|alog(num|
|000061d0| 46 69 6c 74 65 72 55 50 | 50 2c 20 26 68 69 74 29 |FilterUP|P, &hit)|
|000061e0| 3b 20 2f 2a 20 4e 75 6d | 46 69 6c 74 65 72 20 6f |; /* Num|Filter o|
|000061f0| 6e 6c 79 20 61 6c 6c 6f | 77 73 20 6e 75 6d 65 72 |nly allo|ws numer|
|00006200| 69 63 20 69 6e 70 75 74 | 20 2a 2f 0d 09 09 73 77 |ic input| */...sw|
|00006210| 69 74 63 68 28 68 69 74 | 29 0d 09 09 7b 0d 09 09 |itch(hit|)...{...|
|00006220| 09 63 61 73 65 20 69 4f | 4b 42 75 74 74 6f 6e 3a |.case iO|KButton:|
|00006230| 09 09 09 09 2f 2a 20 4f | 4b 20 62 75 74 74 6f 6e |..../* O|K button|
|00006240| 20 68 69 74 2e 2e 2e 2a | 2f 0d 09 09 09 09 69 66 | hit...*|/.....if|
|00006250| 28 4a 75 67 67 6c 65 53 | 69 7a 65 4f 4b 28 74 68 |(JuggleS|izeOK(th|
|00006260| 65 44 6c 6f 67 29 29 0d | 09 09 09 09 7b 0d 09 09 |eDlog)).|....{...|
|00006270| 09 09 09 2a 6e 75 6d 4a | 75 67 67 6c 65 72 73 20 |...*numJ|ugglers |
|00006280| 3d 20 44 6c 6f 67 54 6f | 53 68 6f 72 74 28 74 68 |= DlogTo|Short(th|
|00006290| 65 44 6c 6f 67 2c 20 69 | 4e 75 6d 4a 75 67 67 6c |eDlog, i|NumJuggl|
|000062a0| 65 72 73 29 3b 0d 09 09 | 09 09 09 2a 6e 75 6d 43 |ers);...|...*numC|
|000062b0| 6f 75 6e 74 73 20 3d 20 | 44 6c 6f 67 54 6f 53 68 |ounts = |DlogToSh|
|000062c0| 6f 72 74 28 74 68 65 44 | 6c 6f 67 2c 20 69 4e 75 |ort(theD|log, iNu|
|000062d0| 6d 43 6f 75 6e 74 73 29 | 3b 0d 09 09 09 09 09 2f |mCounts)|;....../|
|000062e0| 2f 20 4d 61 6b 65 20 73 | 75 72 65 20 6e 75 6d 43 |/ Make s|ure numC|
|000062f0| 6f 75 6e 74 73 20 69 73 | 20 65 76 65 6e 0d 09 09 |ounts is| even...|
|00006300| 09 09 09 69 66 28 28 2a | 6e 75 6d 43 6f 75 6e 74 |...if((*|numCount|
|00006310| 73 20 25 20 32 29 20 3d | 3d 20 31 29 0d 09 09 09 |s % 2) =|= 1)....|
|00006320| 09 09 09 2a 6e 75 6d 43 | 6f 75 6e 74 73 20 2b 3d |...*numC|ounts +=|
|00006330| 20 31 3b 0d 09 09 09 09 | 09 65 78 69 74 44 69 61 | 1;.....|.exitDia|
|00006340| 6c 6f 67 20 3d 20 74 72 | 75 65 3b 0d 09 09 09 09 |log = tr|ue;.....|
|00006350| 7d 0d 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 0d 09 |}.....br|eak;....|
|00006360| 09 09 63 61 73 65 20 69 | 43 61 6e 63 65 6c 42 75 |..case i|CancelBu|
|00006370| 74 74 6f 6e 3a 09 09 09 | 2f 2a 20 43 61 6e 63 65 |tton:...|/* Cance|
|00006380| 6c 20 62 75 74 74 6f 6e | 20 68 69 74 2e 2e 2e 2a |l button| hit...*|
|00006390| 2f 0d 09 09 09 09 65 78 | 69 74 44 69 61 6c 6f 67 |/.....ex|itDialog|
|000063a0| 20 3d 20 74 72 75 65 3b | 0d 09 09 09 09 62 72 65 | = true;|.....bre|
|000063b0| 61 6b 3b 0d 09 0d 09 09 | 09 64 65 66 61 75 6c 74 |ak;.....|.default|
|000063c0| 3a 09 09 09 09 09 2f 2a | 20 41 6e 79 74 68 69 6e |:...../*| Anythin|
|000063d0| 67 20 65 6c 73 65 20 68 | 69 74 2e 2e 2e 20 2a 2f |g else h|it... */|
|000063e0| 0d 09 09 09 09 63 6f 6e | 74 69 6e 75 65 3b 0d 09 |.....con|tinue;..|
|000063f0| 09 7d 0d 09 7d 0d 09 53 | 65 74 43 75 72 73 6f 72 |.}..}..S|etCursor|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.